Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EHOSTDOWN error on MacOS #44

Open
max-mapper opened this issue Oct 16, 2020 · 3 comments
Open

EHOSTDOWN error on MacOS #44

max-mapper opened this issue Oct 16, 2020 · 3 comments

Comments

@max-mapper
Copy link

Hi again, I was using the server module on my machine (arch linux) and was able to get everything to work OK using the following code (example code)

const AWS = require('aws-sdk') // version 2.746.0

const sqs = new AWS.SQS({
  region: 'us-east-1',
  apiVersion: '2012-11-05',
})

const server = new (require('@abetomo/simply-imitated-sqs').Server)()

let queueUrl = server.run({
  port,
  host: 'localhost',
})

const queueJob = async (name, payload, delay) => {
  const params = {
    QueueUrl: queueUrl,
    MessageBody: JSON.stringify({
      name,
      data: payload,
    }),
    DelaySeconds: delay,
  }
  await sqs.sendMessage(params).promise()
}

However, on my co-workers computer (mac OS, same aws-sdk version) calling sqs.sendMessage resulted in an error Error: connect EHOSTDOWN 169.254.169.254:80, it looked very similar to this one: aws/aws-sdk-js#2038

I thought maybe aws-sdk tries to do some authentication request to the sqs server but I saw no requests being made to the test sqs http server. I was unable to reproduce on my machine. My co-worker confirmed he was authenticated with a working AWS profile and tried again, but received another EHOSTDOWN error

@abetomo
Copy link
Owner

abetomo commented Oct 17, 2020

@maxogden If the port is 80, it seems to cause an error.
It worked when I set the port to 1234 or 8000.

@max-mapper
Copy link
Author

Ah interesting. I had port set to '7377' when testing yesterday, definitely not 80

@abetomo
Copy link
Owner

abetomo commented Oct 17, 2020

The value can be anything. (It doesn't have to be an official key.)
Does it work if I specify an environment variable at runtime?

Example.

% AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test node index.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants