Search code examples
amazon-web-servicesember.jsdeploymentember-cli

Ember AWS deploy failing - CredentialsError & EHOSTUNREACH


Having trouble getting the ember-cli-deploy addon to deploy successfully to our AWS development environment.

The pipeline seems to fail resulting in one of two errors:

...
- build ok
|
+- didBuild
|
+- willPrepare
|
+- prepare
|  |
|  +- revision-data
- creating revision data using `version-commit`
- generated revision data for revision: `0.1.9+4a4f79a3`
|
+- didPrepare
|
+- fetchInitialRevisions
|  |
|  +- s3-index
|
+- didFail
CredentialsError: Missing credentials in config
CredentialsError: Missing credentials in config
    at ClientRequest.<anonymous> (/Users/certus/Desktop/branz-web/node_modules/aws-sdk/lib/http/node.js:83:34)
    at Object.onceWrapper (events.js:293:19)
    at emitNone (events.js:86:13)
    at ClientRequest.emit (events.js:188:7)
    at Socket.emitTimeout (_http_client.js:679:10)
    at Object.onceWrapper (events.js:293:19)
    at emitNone (events.js:86:13)
    at Socket.emit (events.js:188:7)
    at Socket._onTimeout (net.js:352:8)
|
Pipeline aborted

Or:

...
- build ok
|
+- didBuild
|
+- willPrepare
|
+- prepare
|  |
|  +- revision-data
- creating revision data using `version-commit`
- generated revision data for revision: `0.1.9+4a4f79a3`
|
+- didPrepare
|
+- fetchInitialRevisions
|  |
|  +- s3-index
events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: connect EHOSTUNREACH 169.254.169.254:80 - Local (192.168.20.110:64572)
    at Object.exports._errnoException (util.js:1050:11)
    at exports._exceptionWithHostPort (util.js:1073:20)
    at internalConnect (net.js:889:16)
    at lookupAndConnect (net.js:977:5)
    at Socket.realConnect (net.js:945:5)
    at Agent.connect [as createConnection] (net.js:77:22)
    at Agent.createSocket (_http_agent.js:195:26)
    at Agent.addRequest (_http_agent.js:157:10)
    at new ClientRequest (_http_client.js:212:16)
    at Object.request (http.js:26:10)

The AWS keys are stored, as per the ember-cli-deploy docs, in a file at the root of the project called .env.deploy.develop containing the AWS key and secrets:

AWS_KEY​=ABC..
AWS_SECRET​=ABC…

I am confident that there is nothing wrong with the build setup, as it was used extensively before me, however, what else could be going wrong on my end assuming the key and secret are correct?

I have read elsewhere that memory available could play a factor; accordingly, I closed down most of the apps running before attempting to deploy. Have also cleared node_modules and cleared the npm cache before reinstalling. However, to no avail.

Any suggestions would be most welcome.

  • npm - v4.2.0
  • node - v7.10.1
  • ember-cli - v2.13.0
  • ember-cli-deploy - v1.0.2

Solution

  • Ok, looking into this further, it seems that the issue is that the build can't seem to read the .env files containing the AWS key and secret as per the first error.

    This was confirmed by hardcoding the secret and key into the /config/deploy.js file in replacement of the process.env.AWS_KEY and process.env.AWS_SECRET variables.

    Since this issue no longer relates the scope of this question, I will close this question and open another.