Hey there @halfer, thanks for your response. I’ve pasted the npm log from a failed deploy today below.
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'deploy-stage' ]
2 info using npm@5.6.0
3 info using node@v8.10.0
4 verbose run-script [ 'predeploy-stage', 'deploy-stage', 'postdeploy-stage' ]
5 info lifecycle REDACTED@1.0.0~predeploy-stage: REDACTED@1.0.0
6 info lifecycle REDACTED@1.0.0~deploy-stage: REDACTED@1.0.0
7 verbose lifecycle REDACTED@1.0.0~deploy-stage: unsafe-perm in lifecycle true
8 verbose lifecycle REDACTED@1.0.0~deploy-stage: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/tmp/workspace/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9 verbose lifecycle REDACTED@1.0.0~deploy-stage: CWD: /tmp/workspace
10 silly lifecycle REDACTED@1.0.0~deploy-stage: Args: [ '-c', 'serverless deploy --stage stage --env stage -v' ]
11 silly lifecycle REDACTED@1.0.0~deploy-stage: Returned: code: 126 signal: null
12 info lifecycle REDACTED@1.0.0~deploy-stage: Failed to exec deploy-stage script
13 verbose stack Error: REDACTED@1.0.0 deploy-stage: `serverless deploy --stage stage --env stage -v`
13 verbose stack Exit status 126
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid REDACTED@1.0.0
15 verbose cwd /tmp/workspace
16 verbose Linux 4.15.0-1035-aws
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "deploy-stage"
18 verbose node v8.10.0
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 126
22 error REDACTED@1.0.0 deploy-stage: `serverless deploy --stage stage --env stage -v`
22 error Exit status 126
23 error Failed at the REDACTED@1.0.0 deploy-stage script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]
The only thing that I can think of that is notable in our workflow is that we npm install dependencies (including serverless) in one job and then save these dependencies to a workspace that gets mounted to another job container later in the workflow during the deployment. Perhaps there is some sort of race condition where the serverless
binary sometimes doesn’t have the correct executable permissions once mounted in the deploy job?