Error: getaddrinfo ENOENT #7

Open
nkhine opened this Issue Apr 12, 2012 · 5 comments

Comments

Projects
None yet
2 participants

nkhine commented Apr 12, 2012

i have this:

$ node app.js                                                                                                                                                                  ""

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
          ^
Error: getaddrinfo ENOENT
    at errnoException (dns.js:31:11)
    at Object.onanswer [as oncomplete] (dns.js:140:16)

here is the code:

var ec2 = require("ec2")
, fs = require("fs");

// Read in the configuration above.
var configuration = JSON.parse(fs.readFileSync("configuration.json", "utf8"));

// Create an ec2 function that uses your configuration.
ec2 = ec2(configuration)

// Run an instance and wait for it to become ready.
ec2("RunInstances", {
  ImageId: "ami-5d704b29", KeyName: "micros-ie", InstanceType: "t1.micro"
}, function (error, response) {
  if (error) {
    throw error
  }
  reservationId   = response.reservationId;
  instanceId      = response.instancesSet[0].instanceId;
  ready = function () {
    ec2("DescribeInstances", function (error, struct) {
      if (error) {
        throw error;
      }
      var reservation = struct.reservationSet.filter(function (reservation) {
        return reservation.reservationId == reservationId;
      })[0];
      var instance = reservation.instancesSet.filter(function (instance) {
        return instance.instanceId == instanceId;
      })[0];
      return instance.instanceState.name == "running";
      if (instance.instanceState.name == "running") {
        console.log("Instance created with id: " + instanceId);
      } else {
        setTimeout(ready, 500);
      }
    });
  };
  ready();
});

bigeasy was assigned Apr 12, 2012

Collaborator

bigeasy commented Apr 12, 2012

Is DNS failing? What value did you set for the endpoint?

nkhine commented Apr 12, 2012

sorry, i just found the project and am unsure how to specify the endpoint?

in the configuration.json file, i have this:

{ "key": "AWS_ACCESS_KEY_ID"
, "secret": "AWS_SECRET_ACCESS_KEY"
, "endpoint": "ec2.eu-west-1.amazonaws.com"
}

is this correct waay to do it?

Collaborator

bigeasy commented Apr 12, 2012

Just eu-west-1.

Collaborator

bigeasy commented Apr 12, 2012

I'm going to leave this issue open. The library should throw an exception if it is missing configuration.

nkhine commented Apr 12, 2012

ok, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment