twilio-labs / plugin-serverless

Twilio CLI plugin to work with Serverless
MIT License
21 stars 14 forks source link

twilio serverless:deploy unexpected error #30

Closed thorsten-stripe closed 4 years ago

thorsten-stripe commented 4 years ago

Moved here as advised in https://github.com/twilio/twilio-cli/issues/173

Technical details:

Account AC2e28b44893fdebc06eb44c73fa07c03b Token 82be**** Service Name stripe-payment-link-sms Environment dev Root Directory /Users/thorsten/Documents/twilio/function-templates/stripe-payment-link-sms Dependencies stripe Env Variables STRIPE_SECRET_KEY

⠋ Deploying Function twilio-serverless-api:client Deploy config { twilio-serverless-api:client cwd: '/Users/thorsten/Documents/twilio/function-templates/stripe-payment-link-sms', twilio-serverless-api:client envPath: '/Users/thorsten/Documents/twilio/function-templates/stripe-payment-link-sms/.env', twilio-serverless-api:client accountSid: 'AC2e28b44893fdebc06eb44c73fa07c03b', twilio-serverless-api:client authToken: '[REDACTED]', twilio-serverless-api:client env: { STRIPE_SECRET_KEY: '[REDACTED]' }, twilio-serverless-api:client serviceSid: 'ZS5ad06539c2d5760d7b5f7218bc1f5649', twilio-serverless-api:client pkgJson: { name: '[REDACTED]', dependencies: '[REDACTED]' }, twilio-serverless-api:client overrideExistingService: false, twilio-serverless-api:client force: false, twilio-serverless-api:client serviceName: 'stripe-payment-link-sms', 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 "/Users/thorsten/Documents/twilio/function-templates/stripe-payment-link-sms/functions" +0ms twilio-serverless-api:fs Search for directory. Options: "assets,static" +0ms twilio-serverless-api:fs Found Assets Directory "undefined" +1ms ⠸ Configuring "dev" environment twilio-serverless-api:utils:pagination GotError [HTTPError]: Response code 404 (NOT FOUND) twilio-serverless-api:utils:pagination at EventEmitter. (/Users/thorsten/.twilio-cli/node_modules/got/source/as-promise.js:74:19) twilio-serverless-api:utils:pagination at processTicksAndRejections (internal/process/task_queues.js:97:5) { twilio-serverless-api:utils:pagination name: 'HTTPError', twilio-serverless-api:utils:pagination host: undefined, twilio-serverless-api:utils:pagination hostname: 'serverless.twilio.com', twilio-serverless-api:utils:pagination method: 'GET', twilio-serverless-api:utils:pagination path: '/v1/Services/ZS5ad06539c2d5760d7b5f7218bc1f5649/Environments', twilio-serverless-api:utils:pagination socketPath: undefined, twilio-serverless-api:utils:pagination protocol: 'https:', twilio-serverless-api:utils:pagination url: 'https://serverless.twilio.com/v1/Services/ZS5ad06539c2d5760d7b5f7218bc1f5649/Environments', twilio-serverless-api:utils:pagination gotOptions: { twilio-serverless-api:utils:pagination path: '/v1/Services/ZS5ad06539c2d5760d7b5f7218bc1f5649/Environments', twilio-serverless-api:utils:pagination protocol: 'https:', twilio-serverless-api:utils:pagination hostname: 'serverless.twilio.com', twilio-serverless-api:utils:pagination hash: '', twilio-serverless-api:utils:pagination search: '', twilio-serverless-api:utils:pagination pathname: '/v1/Services/ZS5ad06539c2d5760d7b5f7218bc1f5649/Environments', twilio-serverless-api:utils:pagination href: 'https://serverless.twilio.com/v1/Services/ZS5ad06539c2d5760d7b5f7218bc1f5649/Environments', twilio-serverless-api:utils:pagination retry: { twilio-serverless-api:utils:pagination retries: [Function (anonymous)], twilio-serverless-api:utils:pagination methods: [Set], twilio-serverless-api:utils:pagination statusCodes: [Set], twilio-serverless-api:utils:pagination errorCodes: [Set] twilio-serverless-api:utils:pagination }, twilio-serverless-api:utils:pagination headers: { twilio-serverless-api:utils:pagination 'user-agent': 'twilio-serverless-api', twilio-serverless-api:utils:pagination accept: 'application/json', twilio-serverless-api:utils:pagination 'accept-encoding': 'gzip, deflate' twilio-serverless-api:utils:pagination }, twilio-serverless-api:utils:pagination hooks: { twilio-serverless-api:utils:pagination beforeError: [], twilio-serverless-api:utils:pagination init: [], twilio-serverless-api:utils:pagination beforeRequest: [], twilio-serverless-api:utils:pagination beforeRedirect: [], twilio-serverless-api:utils:pagination beforeRetry: [], twilio-serverless-api:utils:pagination afterResponse: [] twilio-serverless-api:utils:pagination }, twilio-serverless-api:utils:pagination decompress: true, twilio-serverless-api:utils:pagination throwHttpErrors: true, twilio-serverless-api:utils:pagination followRedirect: true, twilio-serverless-api:utils:pagination stream: false, twilio-serverless-api:utils:pagination form: false, twilio-serverless-api:utils:pagination json: true, twilio-serverless-api:utils:pagination cache: false, twilio-serverless-api:utils:pagination useElectronNet: false, twilio-serverless-api:utils:pagination baseUrl: [Getter/Setter], twilio-serverless-api:utils:pagination auth: 'AC2e28b44893fdebc06eb44c73fa07c03b:[REDACTED]', twilio-serverless-api:utils:pagination method: 'GET' twilio-serverless-api:utils:pagination }, twilio-serverless-api:utils:pagination statusCode: 404, twilio-serverless-api:utils:pagination statusMessage: 'NOT FOUND', twilio-serverless-api:utils:pagination headers: { twilio-serverless-api:utils:pagination date: 'Fri, 17 Apr 2020 10:26:22 GMT', twilio-serverless-api:utils:pagination 'content-type': 'application/json', twilio-serverless-api:utils:pagination 'content-length': '196', twilio-serverless-api:utils:pagination connection: 'close', twilio-serverless-api:utils:pagination 'twilio-request-id': 'RQec0c62821ed04af6aedf21b7d40d4161', twilio-serverless-api:utils:pagination 'twilio-request-duration': '0.039', twilio-serverless-api:utils:pagination 'access-control-allow-origin': '', twilio-serverless-api:utils:pagination 'access-control-allow-headers': 'Accept, Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since', twilio-serverless-api:utils:pagination 'access-control-allow-methods': 'GET, POST, DELETE, OPTIONS', twilio-serverless-api:utils:pagination 'access-control-expose-headers': 'ETag', twilio-serverless-api:utils:pagination 'access-control-allow-credentials': 'true', twilio-serverless-api:utils:pagination 'x-powered-by': 'AT-5000', twilio-serverless-api:utils:pagination 'x-shenanigans': 'none', twilio-serverless-api:utils:pagination 'x-home-region': 'us1', twilio-serverless-api:utils:pagination 'x-api-domain': 'serverless.twilio.com', twilio-serverless-api:utils:pagination 'strict-transport-security': 'max-age=31536000' twilio-serverless-api:utils:pagination }, twilio-serverless-api:utils:pagination body: { twilio-serverless-api:utils:pagination code: 20404, twilio-serverless-api:utils:pagination message: 'The requested resource /Services/ZS5ad06539c2d5760d7b5f7218bc1f5649/Environments was not found', twilio-serverless-api:utils:pagination more_info: 'https://www.twilio.com/docs/errors/20404', twilio-serverless-api:utils:pagination status: 404 twilio-serverless-api:utils:pagination } ⠧ Configuring "dev" environment twilio-run:deploy GotError [HTTPError]: Response code 404 (NOT FOUND) twilio-run:deploy at EventEmitter. (/Users/thorsten/.twilio-cli/node_modules/got/source/as-promise.js:74:19) twilio-run:deploy at processTicksAndRejections (internal/process/task_queues.js:97:5) { twilio-run:deploy name: 'HTTPError', twilio-run:deploy host: undefined, twilio-run:deploy hostname: 'serverless.twilio.com', twilio-run:deploy method: 'POST', twilio-run:deploy path: '/v1/Services/ZS5ad06539c2d5760d7b5f7218bc1f5649/Environments', twilio-run:deploy socketPath: undefined, twilio-run:deploy protocol: 'https:', twilio-run:deploy url: 'https://serverless.twilio.com/v1/Services/ZS5ad06539c2d5760d7b5f7218bc1f5649/Environments', twilio-run:deploy gotOptions: { twilio-run:deploy path: '/v1/Services/ZS5ad06539c2d5760d7b5f7218bc1f5649/Environments', twilio-run:deploy protocol: 'https:', twilio-run:deploy hostname: 'serverless.twilio.com', twilio-run:deploy hash: '', twilio-run:deploy search: '', twilio-run:deploy pathname: '/v1/Services/ZS5ad06539c2d5760d7b5f7218bc1f5649/Environments', twilio-run:deploy href: 'https://serverless.twilio.com/v1/Services/ZS5ad06539c2d5760d7b5f7218bc1f5649/Environments', twilio-run:deploy retry: { twilio-run:deploy retries: [Function (anonymous)], twilio-run:deploy methods: [Set], twilio-run:deploy statusCodes: [Set], twilio-run:deploy errorCodes: [Set] twilio-run:deploy }, twilio-run:deploy headers: { twilio-run:deploy 'user-agent': 'twilio-serverless-api', twilio-run:deploy accept: 'application/json', twilio-run:deploy 'accept-encoding': 'gzip, deflate', twilio-run:deploy 'content-type': 'application/x-www-form-urlencoded', twilio-run:deploy 'content-length': 105 twilio-run:deploy }, twilio-run:deploy hooks: { twilio-run:deploy beforeError: [], twilio-run:deploy init: [], twilio-run:deploy beforeRequest: [], twilio-run:deploy beforeRedirect: [], twilio-run:deploy beforeRetry: [], twilio-run:deploy afterResponse: [] twilio-run:deploy }, twilio-run:deploy decompress: true, twilio-run:deploy throwHttpErrors: true, twilio-run:deploy followRedirect: true, twilio-run:deploy stream: false, twilio-run:deploy form: true, twilio-run:deploy json: true, twilio-run:deploy cache: false, twilio-run:deploy useElectronNet: false, twilio-run:deploy baseUrl: [Getter/Setter], twilio-run:deploy auth: 'AC2e28b44893fdebc06eb44c73fa07c03b:[REDACTED]', twilio-run:deploy body: 'UniqueName=dev-environment&DomainSuffix=dev&FriendlyName=dev-environment+Environment+%28Created+by+CLI%29', twilio-run:deploy method: 'POST' twilio-run:deploy }, twilio-run:deploy statusCode: 404, twilio-run:deploy statusMessage: 'NOT FOUND', twilio-run:deploy headers: { twilio-run:deploy date: 'Fri, 17 Apr 2020 10:26:23 GMT', twilio-run:deploy 'content-type': 'application/json', twilio-run:deploy 'content-length': '196', twilio-run:deploy connection: 'close', twilio-run:deploy 'twilio-request-id': 'RQ8fa7f421ce794c31853764026a26b961', twilio-run:deploy 'twilio-request-duration': '0.029', twilio-run:deploy 'access-control-allow-origin': '', twilio-run:deploy 'access-control-allow-headers': 'Accept, Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since', twilio-run:deploy 'access-control-allow-methods': 'GET, POST, DELETE, OPTIONS', twilio-run:deploy 'access-control-expose-headers': 'ETag', twilio-run:deploy 'access-control-allow-credentials': 'true', twilio-run:deploy 'x-powered-by': 'AT-5000', twilio-run:deploy 'x-shenanigans': 'none', twilio-run:deploy 'x-home-region': 'us1', twilio-run:deploy 'x-api-domain': 'serverless.twilio.com', twilio-run:deploy 'strict-transport-security': 'max-age=31536000' twilio-run:deploy }, twilio-run:deploy body: { twilio-run:deploy code: 20404, twilio-run:deploy message: 'The requested resource /Services/ZS5ad06539c2d5760d7b5f7218bc1f5649/Environments was not found', twilio-run:deploy more_info: 'https://www.twilio.com/docs/errors/20404', twilio-run:deploy status: 404 twilio-run:deploy } ✖ Failed Deployment » twilio-cli encountered an unexpected error. To report this issue, execute the command with the "-l debug" flag, then copy the output to a new issue here: https://github.com/twilio/twilio-cli/issues

welcome[bot] commented 4 years ago

Thank you so much for opening your first issue for this project! We'll try to get back to it as quickly as possible. While you are waiting...here's a random picture of a corgi (powered by dog.ceo)

picture of dog

dkundel commented 4 years ago

Hi @thorsten-stripe! This error could be a couple of different issues. My first gut feeling says that the serviceSid that you have stored in your .twilio-functions file might not be associated with the account you are logged into with the Twilio CLI. There's two ways you can verify whether that's the case.

  1. Run twilio serverless:list services
  2. Open the Twilio Console at: https://www.twilio.com/console/functions/api

In both cases you want to look for ZS5ad06539c2d5760d7b5f7218bc1f5649.

If you can't find it that means it's deployed to an account with different credentials. Make sure you swap them out in the .env file or by using the --profile flag on the Twilio CLI. Alternatively delete the .twilio-functions file in your project and run deploy again.

thorsten-stripe commented 4 years ago

Thanks @dkundel