twilio-labs / dev-phone

A developer tool for testing SMS and Voice applications
MIT License
77 stars 20 forks source link

dev-phone: Failed to upload Function Sync Call History #195

Open eherot opened 8 months ago

eherot commented 8 months ago

The following error is thrown during startup on the twilio/twilio-cli:5.18.0 docker container:

...

๐Ÿ’ป Deploying a Functions Service to handle incoming calls and SMS...
๐Ÿง‘โ€๐Ÿ’ป Creating Service
๐Ÿง‘โ€๐Ÿ’ป Configuring bare environment
๐Ÿง‘โ€๐Ÿ’ป Creating 4 Functions
๐Ÿง‘โ€๐Ÿ’ป Uploading 4 Functions
2024-02-22T22:28:38.604Z twilio-serverless-api:functions Uploading asset via form data with content-type "application/javascript"
2024-02-22T22:28:38.606Z twilio-serverless-api:functions Uploading asset via form data with content-type "application/javascript"
2024-02-22T22:28:38.607Z twilio-serverless-api:functions Uploading asset via form data with content-type "application/javascript"
2024-02-22T22:28:38.609Z twilio-serverless-api:functions Uploading asset via form data with content-type "application/javascript"
2024-02-22T22:28:38.883Z twilio-serverless-api:functions ClientApiError [HTTPError]: Response code 401 (Unauthorized)
    at /root/.twilio-cli/node_modules/@twilio-labs/serverless-api/dist/api/functions.js:133:23
    at Generator.throw (<anonymous>)
    at rejected (/root/.twilio-cli/node_modules/@twilio-labs/serverless-api/dist/api/functions.js:7:65)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 401,
  url: 'https://serverless-upload.twilio.com/v1/Services/ZS239a62fb7dd57e87a5e8c633ae80a11f/Functions/ZHfb0143397df6f290aabdc64bc31c5411/Versions'
}
Error: Failed to upload Function Incoming Call Handler
    at /root/.twilio-cli/node_modules/@twilio-labs/serverless-api/dist/api/functions.js:134:19
    at Generator.throw (<anonymous>)
    at rejected (/root/.twilio-cli/node_modules/@twilio-labs/serverless-api/dist/api/functions.js:7:65)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[DEBUG] Found command "dev-phone" plugin: @twilio-labs/plugin-dev-phone
 ยป 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-labs/dev-phone/issues"
[DEBUG] Issue deploying functions. Try again later
[DEBUG] Error: Issue deploying functions. Try again later
    at /root/.twilio-cli/node_modules/@twilio-labs/plugin-dev-phone/dist/utils/create-serverless-util.js:82:19
    at Generator.throw (<anonymous>)
    at rejected (/root/.twilio-cli/node_modules/@twilio-labs/plugin-dev-phone/dist/utils/create-serverless-util.js:6:65)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Error: EEXIT: 1
    at Object.exit (/root/.twilio-cli/node_modules/@oclif/core/lib/errors/index.js:22:11)
    at DevPhoneServer.exit (/root/.twilio-cli/node_modules/@oclif/core/lib/command.js:95:23)
    at DevPhoneServer.catch (/root/.twilio-cli/node_modules/@twilio/cli-core/src/base-commands/base-command.js:91:12)
    at DevPhoneServer.catch (/root/.twilio-cli/node_modules/@twilio/cli-core/src/base-commands/twilio-client-command.js:76:23)
    at DevPhoneServer._run (/root/.twilio-cli/node_modules/@oclif/core/lib/command.js:84:29)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Config.runCommand (/twilio/node_modules/@oclif/core/lib/config/config.js:301:25)

But the "Incoming Call Handler" function does seem to be getting created in what appears to be its entirety (in fact if I let this run long enough it will eventually start erroring with "too many services")...

UPDATE: So after manually updating @twilio-labs/serverless-api/dist/api/functions.js in place to add a log line right after the client.request('post' what I can see is that it is never reaching that point for any uploaded function. So somehow the function is being stored in the account but the request returns 401.

ayyrickay commented 7 months ago

To be honest I'm pretty confused about what could be happening here. Have you tried doing this with different Twilio credentials? Additionally, is this a trial account? I'm not sure, but it comes to mind as something that might be an issue while creating/interacting with resources.