dabblelab / twilio-cli-autopilot-plugin

A Twilio CLI plugin for streamlining Twilio Autopilot development workflows.
MIT License
13 stars 7 forks source link

autopilot:deploy errors out with "Cannot read property 'startsWith' of undefined" #33

Open yvesonline opened 3 years ago

yvesonline commented 3 years ago

First of all great work with the autopilot plugin, I find it already very useful doing my first steps with Twilio Autopilot!

I'm running into an issue where autopilot:deploy gives me consistently a Cannot read property 'startsWith' of undefined.

The redacted (confidential information removed) output of twilio autopilot:deploy -l debug --override-existing-project --target function is:

  twilio-run:config:credentials Override value with .env ACCOUNT_SID value +0ms
  twilio-run:config:credentials Override value with .env AUTH_TOKEN value +1ms
  twilio-run:deploy Deploy Config %P {
  cwd: '/home/yves/****/function',
  envPath: '/home/yves/****/function/.env',
  username: 'AC****',
  password: '****',
  env: {},
  serviceSid: undefined,
  pkgJson: {
    name: '****',
    version: '0.0.0',
    private: true,
    scripts: { test: 'echo "Error: no test specified" && exit 1' },
    engines: { node: '8.10.0' },
    dependencies: { moment: '^2.24.0' }
  },
  overrideExistingService: true,
  force: undefined,
  serviceName: '****',
  functionsEnv: 'dev',
  functionsFolderName: undefined,
  assetsFolderName: undefined,
  noAssets: false,
  noFunctions: false,
  region: undefined,
  edge: undefined
} +0ms
⠋ Deploying Function  twilio-serverless-api:client Deploy config {
  twilio-serverless-api:client   cwd: '/home/yves/****/function',
  twilio-serverless-api:client   envPath: '/home/yves/****/function/.env',
  twilio-serverless-api:client   username: '[REDACTED]',
  twilio-serverless-api:client   password: '[REDACTED]',
  twilio-serverless-api:client   env: {},
  twilio-serverless-api:client   pkgJson: {
  twilio-serverless-api:client     name: '[REDACTED]',
  twilio-serverless-api:client     version: '[REDACTED]',
  twilio-serverless-api:client     private: '[REDACTED]',
  twilio-serverless-api:client     scripts: '[REDACTED]',
  twilio-serverless-api:client     engines: '[REDACTED]',
  twilio-serverless-api:client     dependencies: '[REDACTED]'
  twilio-serverless-api:client   },
  twilio-serverless-api:client   overrideExistingService: true,
  twilio-serverless-api:client   serviceName: '****',
  twilio-serverless-api:client   functionsEnv: 'dev',
  twilio-serverless-api:client   noAssets: false,
  twilio-serverless-api:client   noFunctions: false
  twilio-serverless-api:client } +0ms
  twilio-serverless-api:fs Search for directory. Options: "functions,src" +0ms
  twilio-serverless-api:fs Found Functions Directory "/home/yves/****/function/functions" +0ms
  twilio-serverless-api:fs Search for directory. Options: "assets,static" +0ms
  twilio-serverless-api:fs Found Assets Directory "undefined" +0ms
⠴ Creating Service
  twilio-serverless-api:services ClientApiError [TwilioApiError]: Service with this UniqueName already exists.
  twilio-serverless-api:services     at Object.<anonymous> (/home/yves/.twilio-cli/node_modules/@twilio-labs/serverless-api/dist/api/services.js:43:23)
  twilio-serverless-api:services     at Generator.throw (<anonymous>)
  twilio-serverless-api:services     at rejected (/home/yves/.twilio-cli/node_modules/@twilio-labs/serverless-api/dist/api/services.js:7:65)
  twilio-serverless-api:services     at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  twilio-serverless-api:services   code: 20409,
  twilio-serverless-api:services   details: {
  twilio-serverless-api:services     code: 20409,
  twilio-serverless-api:services     message: 'Service with this UniqueName already exists.',
  twilio-serverless-api:services     more_info: 'https://www.twilio.com/docs/errors/20409',
  twilio-serverless-api:services     status: 409,
  twilio-serverless-api:services     request_url: 'https://serverless.twilio.com/v1/Services'
  twilio-serverless-api:services   }
⠋ Creating 1 Functions
  twilio-serverless-api:functions Uploading asset via form data with content-type "application/javascri✔ Serverless function successfully deployed
  twilio-run:deploy TypeError: Cannot read property 'startsWith' of undefined
  twilio-run:deploy     at /home/yves/.twilio-cli/node_modules/@dabblelab/plugin-autopilot/src/lib/serverless/deploy.js:92:104
  twilio-run:deploy     at Generator.next (<anonymous>)
  twilio-run:deploy     at fulfilled (/home/yves/.twilio-cli/node_modules/@dabblelab/plugin-autopilot/src/lib/serverless/deploy.js:4:58)
  twilio-run:deploy     at processTicksAndRejections (internal/process/task_queues.js:97:5) +16s
✖ Failed Deployment

│ ERROR 
│ 
│ Cannot read property 'startsWith' of undefined

What I have tried so far:

I'm a bit lost, what could be the issue? It looks like my account sid can't be found and as a matter of fact it's not in the config but this is just after a fresh twilio autopilot:init.

tingiris commented 3 years ago

Hi @yvesonline, thanks for bringing this to our attention. We've are able to reproduce the error and we're working on a patch. Thanks again!