meandavejustice / deploy-txp

a tool to assist with deployment of Testpilot experiments
https://testpilot.firefox.com/
Mozilla Public License 2.0
0 stars 3 forks source link

More error checking for env variables? #2

Open pdehaan opened 7 years ago

pdehaan commented 7 years ago

I'm testing this new npm run deploy flow on min-vid and I don't have the prerequisite env vars because I don't have AMO signing rights.

But running npm run deploy fails with a pretty unpleasing stack dump, which doesn't give me great instructions.

Steps to reproduce:

  1. git clone https://github.com/meandavejustice/min-vid.git
  2. npm install
  3. npm run deploy

Actual results:

...
/Users/pdehaan/dev/github/mozilla/min-vid/node_modules/jwa/index.js:32
      throw typeError(MSG_INVALID_SECRET);
      ^

TypeError: secret must be a string or buffer
    at typeError (/Users/pdehaan/dev/github/mozilla/min-vid/node_modules/jwa/index.js:16:10)
    at Object.sign (/Users/pdehaan/dev/github/mozilla/min-vid/node_modules/jwa/index.js:32:13)
    at Object.jwsSign [as sign] (/Users/pdehaan/dev/github/mozilla/min-vid/node_modules/jws/lib/sign-stream.js:23:24)
    at Object.module.exports [as sign] (/Users/pdehaan/dev/github/mozilla/min-vid/node_modules/jsonwebtoken/sign.js:144:16)
    at module.exports (/Users/pdehaan/dev/github/mozilla/min-vid/node_modules/deploy-txp/lib/sign.js:23:25)
    at ChildProcess.packageAddonComplete (/Users/pdehaan/dev/github/mozilla/min-vid/node_modules/deploy-txp/bin/build-addon:17:3)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)

npm ERR! Darwin 16.1.0
npm ERR! argv "/Users/pdehaan/.nvm/versions/node/v6.9.0/bin/node" "/Users/pdehaan/.nvm/versions/node/v6.9.0/bin/npm" "run" "deploy"
npm ERR! node v6.9.0
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! min-vid@0.3.3 deploy: `deploy-txp`
npm ERR! Exit status 1

Seems to be throwing from [roughly] /lib/sign.js:23-26. Not sure if we want to do a pre-check for process.env.TESTPILOT_AMO_USER, and process.env.TESTPILOT_AMO_SECRET and display a friendlier error message with "next steps".