oclif/plugin-update

Update not working on macbooks with M1 chips

isha689 opened this issue · 2 comments

I am getting an error (Error: HTTP 403: Invalid channel stable) when issuing the twilio update command.

Screenshot 2022-10-03 at 5 12 01 PM

Environment:
twilio-cli: 5.0.0
node: v18.10.0
npm: 8.19.2
System: Macbook with M1 chip

Debug logs:

➜  ~ DEBUG=* twilio update
TWILIO_BINPATH=/opt/homebrew/Cellar/twilio/5.0.0/libexec/bin/twilio node /opt/homebrew/Cellar/twilio/5.0.0/libexec/bin/run update
  config reading core plugin /opt/homebrew/Cellar/twilio/5.0.0/libexec +0ms
  config loadJSON /opt/homebrew/Cellar/twilio/5.0.0/libexec/package.json +0ms
  config loadJSON /opt/homebrew/Cellar/twilio/5.0.0/libexec/oclif.manifest.json +0ms
  config:twilio-cli using manifest from /opt/homebrew/Cellar/twilio/5.0.0/libexec/oclif.manifest.json +0ms
  config reading user plugins pjson /Users/ibansal/.twilio-cli/package.json +0ms
  config loadJSON /Users/ibansal/.twilio-cli/package.json +0ms
  config loading plugins [
  {
    name: '@twilio-labs/plugin-dev-phone',
    tag: 'latest',
    type: 'user'
  },
  {
    name: '@twilio-labs/plugin-signal2020',
    tag: 'latest',
    type: 'user'
  },
  { name: '@twilio-labs/plugin-alias', tag: 'latest', type: 'user' }
] +2ms
  config loadJSON /Users/ibansal/.twilio-cli/package.json/package.json +0ms
  config loadJSON /Users/ibansal/.twilio-cli/package.json/package.json +0ms
  config loadJSON /Users/ibansal/.twilio-cli/package.json/package.json +0ms
  config reading user plugin /Users/ibansal/.twilio-cli/node_modules/@twilio-labs/plugin-dev-phone +0ms
  config loadJSON /Users/ibansal/.twilio-cli/node_modules/@twilio-labs/plugin-dev-phone/package.json +0ms
  config reading user plugin /Users/ibansal/.twilio-cli/node_modules/@twilio-labs/plugin-signal2020 +0ms
  config loadJSON /Users/ibansal/.twilio-cli/node_modules/@twilio-labs/plugin-signal2020/package.json +0ms
  config reading user plugin /Users/ibansal/.twilio-cli/node_modules/@twilio-labs/plugin-alias +0ms
  config loadJSON /Users/ibansal/.twilio-cli/node_modules/@twilio-labs/plugin-alias/package.json +0ms
  config loadJSON /Users/ibansal/.twilio-cli/node_modules/@twilio-labs/plugin-dev-phone/oclif.manifest.json +0ms
  config loadJSON /Users/ibansal/.twilio-cli/node_modules/@twilio-labs/plugin-signal2020/oclif.manifest.json +0ms
  config loadJSON /Users/ibansal/.twilio-cli/node_modules/@twilio-labs/plugin-alias/oclif.manifest.json +0ms
  config:@twilio-labs/plugin-dev-phone using manifest from /Users/ibansal/.twilio-cli/node_modules/@twilio-labs/plugin-dev-phone/oclif.manifest.json +0ms
  config:@twilio-labs/plugin-alias using manifest from /Users/ibansal/.twilio-cli/node_modules/@twilio-labs/plugin-alias/oclif.manifest.json +0ms
  config:@twilio-labs/plugin-signal2020 using manifest from /Users/ibansal/.twilio-cli/node_modules/@twilio-labs/plugin-signal2020/oclif.manifest.json +0ms
  config loading plugins [
  '@oclif/plugin-autocomplete',
  '@oclif/plugin-plugins',
  '@oclif/plugin-warn-if-update-available',
  '@oclif/plugin-update',
  '@oclif/plugin-version'
] +4ms
  config reading core plugin /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-autocomplete +0ms
  config loadJSON /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-autocomplete/package.json +0ms
  config reading core plugin /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-update +0ms
  config loadJSON /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-update/package.json +0ms
  config reading core plugin /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-plugins +0ms
  config loadJSON /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-plugins/package.json +0ms
  config reading core plugin /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-warn-if-update-available +0ms
  config loadJSON /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-warn-if-update-available/package.json +0ms
  config reading core plugin /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-version +0ms
  config loadJSON /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-version/package.json +0ms
  config loadJSON /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-autocomplete/oclif.manifest.json +0ms
  config loadJSON /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-plugins/oclif.manifest.json +0ms
  config loadJSON /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-update/oclif.manifest.json +0ms
  config loadJSON /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-warn-if-update-available/oclif.manifest.json +0ms
  config:@oclif/plugin-autocomplete using manifest from /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-autocomplete/oclif.manifest.json +0ms
  config loadJSON /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-version/oclif.manifest.json +0ms
  config:@oclif/plugin-plugins using manifest from /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-plugins/oclif.manifest.json +0ms
  config:@oclif/plugin-update using manifest from /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-update/oclif.manifest.json +0ms
  config:@oclif/plugin-warn-if-update-available using manifest from /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-warn-if-update-available/oclif.manifest.json +0ms
  config:@oclif/plugin-version using manifest from /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-version/oclif.manifest.json +0ms
  config config done +4ms
  config start init hook +0ms
  twilio:twilio-cli:hooks:init start (require) /opt/homebrew/Cellar/twilio/5.0.0/libexec/src/hooks/init/twilio-api.js +0ms
  twilio:@oclif/plugin-update:hooks:init start (require) /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-update/lib/hooks/init.js +0ms
  twilio:@oclif/plugin-warn-if-update-available:hooks:init start (require) /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-warn-if-update-available/lib/hooks/init/check-update.js +0ms
  twilio:twilio-cli:hooks:init done +129ms
  twilio:@oclif/plugin-update:hooks:init done +1ms
  twilio:twilio-cli:hooks:init start (require) /opt/homebrew/Cellar/twilio/5.0.0/libexec/src/hooks/init/buy-phone-number.js +1ms
  twilio:twilio-cli:hooks:init done +0ms
  twilio:twilio-cli:hooks:init start (require) /opt/homebrew/Cellar/twilio/5.0.0/libexec/src/hooks/init/plugin-verification.js +1ms
  twilio:twilio-cli:hooks:init done +1ms
  twilio:@oclif/plugin-warn-if-update-available:hooks:init done +3ms
  config init hook done +148ms
  config runCommand update [] +0ms
  config:@oclif/plugin-update (require) /opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-update/lib/commands/update.js +151ms
  config start prerun hook +2ms
  twilio:twilio-cli:hooks:prerun start (require) /opt/homebrew/Cellar/twilio/5.0.0/libexec/src/hooks/prerun/install-prerun.js +0ms
 » MORE INFO
  twilio:twilio-cli:hooks:prerun done +0ms
  config prerun hook done +1ms
  twilio:update init version: @oclif/core@1.16.3 argv: [] +0ms
  config start preupdate hook +4ms
  config preupdate hook done +0ms
var __line = 1
  , __lines = "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- platform %>-<%- arch %>"
  , __filename = undefined;
try {
  var __output = "";
  function __append(s) { if (s !== undefined && s !== null) __output += s }
  with (locals || {}) {
    ; __append( channel === 'stable' ? '' : 'channels/' + channel + '/' )
    ; __append( platform )
    ; __append("-")
    ; __append( arch )
  }
  return __output;
} catch (e) {
  rethrow(e, __lines, __filename, __line, escapeFn);
}

  http → GET https://twilio-cli-prod.s3.amazonaws.com/darwin-arm64
  http   user-agent: 'twilio-cli/5.0.0 darwin-arm64 node-v18.10.0' +0ms
  http ← GET https://twilio-cli-prod.s3.amazonaws.com/darwin-arm64 403
  http   connection: 'close'
  http   content-type: 'application/xml'
  http   date: 'Mon, 03 Oct 2022 11:00:01 GMT'
  http   server: 'AmazonS3'
  http   transfer-encoding: 'chunked'
  http   x-amz-id-2: 'LShgqMmWEXmES5gP/2jf+SVTbotJoNUgE3jKQ94k/GyPLKagwAIWLGXhKTNZEAXwW8z28n2YiMM='
  http   x-amz-request-id: 'G0DFJ3Z1H18GCN1B'
  http '<?xml version="1.0" encoding="UTF-8"?>\n' +
  http   '<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>G0DFJ3Z1H18GCN1B</RequestId><HostId>LShgqMmWEXmES5gP/2jf+SVTbotJoNUgE3jKQ94k/GyPLKagwAIWLGXhKTNZEAXwW8z28n2YiMM=</HostId></Error>' +1s
twilio-cli: Updating CLI... !
Error: HTTP 403: Invalid channel stable
    at UpdateCli.fetchManifest (/opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-update/lib/update.js:79:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async UpdateCli.runUpdate (/opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/plugin-update/lib/update.js:45:30)
    at async UpdateCommand._run (/opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/core/lib/command.js:81:22)
    at async Config.runCommand (/opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/core/lib/config/config.js:272:25)
    at async Object.run (/opt/homebrew/Cellar/twilio/5.0.0/libexec/node_modules/@oclif/core/lib/main.js:76:5)

Screenshot 2022-10-03 at 5 29 52 PM

@isha689 Thanks for filing the issue. I believe, however, that this an issue with the twilio CLI instead of oclif.

plugin-update uses the machine's os and architecture to build the S3 path to download the tarball from. In this case of an M1 mac, it's darwin-arm64. For a non-M1 mac it would be darwin-x64.

You can see that twilio has a publicly available path for darwin-x64: https://twilio-cli-prod.s3.amazonaws.com/darwin-x64

But the darwin-arm64 results in a 403, https://twilio-cli-prod.s3.amazonaws.com/darwin-arm64 - which is the same error you're seeing in your debug logs

I'm going to close the issue for now but feel free to re-open if you or twilio trace the issue back to this codebase.