JackH
JackH

Reputation: 4745

Timeout when deploying Sails.js application to Google App Engine

I have a new Sails.js application that I am trying to deploy to Google App Engine. When I simply deployed the framework (vanilla Sails.js application created using the CLI sails new web-service), it works just fine. The deployment happened quickly and I am able to access the application by visiting the URL.

I configured the ORM at /config/connections.js to connect to an mLab MongoDB database. After this change, the application works fine on my local machine but when I deploy it to Google App Engine using the terminal, I get the following console error:

Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [13] Timed out when starting VMs.  (1/2 ready, 1 still deploying).

npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "deploy"
npm ERR! node v5.11.0
npm ERR! npm  v2.14.5
npm ERR! code ELIFECYCLE
npm ERR! [email protected] deploy: `gcloud app deploy --project web-service-staging`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] deploy script 'gcloud app deploy --project web-service-staging'.
npm ERR! This is most likely a problem with the web-service package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     gcloud app deploy --project web-service-staging
npm ERR! You can get their info via:
npm ERR!     npm owner ls web-service
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Nag/Code/web-service/npm-debug.log

Here is the output of npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'deploy' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predeploy', 'deploy', 'postdeploy' ]
5 info predeploy [email protected]
6 info deploy [email protected]
7 verbose unsafe-perm in lifecycle true
8 info [email protected] Failed to exec deploy script
9 verbose stack Error: [email protected] deploy: `gcloud app deploy --project web-service-staging`
9 verbose stack Exit status 1
9 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:214:16)
9 verbose stack     at emitTwo (events.js:100:13)
9 verbose stack     at EventEmitter.emit (events.js:185:7)
9 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack     at emitTwo (events.js:100:13)
9 verbose stack     at ChildProcess.emit (events.js:185:7)
9 verbose stack     at maybeClose (internal/child_process.js:850:16)
9 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
10 verbose pkgid [email protected]
11 verbose cwd /Users/Nag/Code/web-service
12 error Darwin 15.5.0
13 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "deploy"
14 error node v5.11.0
15 error npm  v2.14.5
16 error code ELIFECYCLE
17 error [email protected] deploy: `gcloud app deploy --project web-service-staging`
17 error Exit status 1
18 error Failed at the [email protected] deploy script 'gcloud app deploy --project web-service-staging'.
18 error This is most likely a problem with the web-service package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error     gcloud app deploy --project web-service-staging
18 error You can get their info via:
18 error     npm owner ls web-service
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]

Is it having trouble starting because it can't connect to the mLab database? If yes, why is that? Works just fine on my local machine. Would increasing the timeout help? If yes, how do I do so?

Upvotes: 1

Views: 172

Answers (1)

JackH
JackH

Reputation: 4745

Ok, I managed to resolve this by changing the ORM hookTimeout.

In /config/env/development.js and /config/env/production.js, I added the following:

module.exports = {

    // Extends the ORM timeout to connect to the database
    hookTimeout: 240000
};

Upvotes: 1

Related Questions