Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: twilio message create timeout #1004

Open
4 tasks done
kareig opened this issue Feb 15, 2024 · 3 comments
Open
4 tasks done

[Feature Request]: twilio message create timeout #1004

kareig opened this issue Feb 15, 2024 · 3 comments
Labels
type: community enhancement feature request not on Twilio's roadmap

Comments

@kareig
Copy link

kareig commented Feb 15, 2024

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for a feature request that matches the one I want to file, without success.
  • This is not a general Twilio feature request or bug report. It is a feature request for the twilio-node JavaScript package.

Problem Description

Hi,

We have an issue quite often when twilio message create never gets a response and twilio serverless function times out on runtime which has 10s hard limit.

We use v3.29.2.

`

client.messages
.create({
body: 'Hello from twilio-node',
to: '+12345678901', // Text your number
from: '+12345678901', // From a valid Twilio number
})
.then((message) => console.log(message.sid));

`

So given the example on such scenario it never proceeds to .then() and twilio serverless function gets runtime timeout.

Twilio support is asking for proof, we do have logging and we clearly see that twilio helper never proceeds to .then(), but that is not enough.

Maybe having an official built-in timeout for .create() would help better, because now we doing axios call to twilio helper instead with timeout of 5s in order to provide some proof of such issue.

Thanks

Proposed Solution

Provide timeout for .create() in order to terminate waiting for the response.

Alternatives Considered

Provide timeout for .create() in order to terminate waiting for the response.

Additional Information

No response

@kareig kareig added the type: community enhancement feature request not on Twilio's roadmap label Feb 15, 2024
@kareig
Copy link
Author

kareig commented Feb 15, 2024

going over source i see there are all the undocumented options i could use and will try them: options

@thomas-topway-it
Copy link

hello @kareig , we are having the same problem using it from svelte (vercel) server-side. Finally how have you solved it ?

Here is our import

import TwilioSdk from 'twilio';
const twilio = TwilioSdk(accountSid, authToken, {
  lazyLoading: false,
  autoRetry: true,
  maxRetries: 3,
  logLevel: 'debug',
});

@kareig
Copy link
Author

kareig commented Mar 19, 2024

Hi @thomas-topway-it,

Few things solved our issues we had:

  1. adding timeout/retry on twilio client:
const twilioClient = context.getTwilioClient({
      autoRetry: true,
      maxRetries: 3,
      maxRetryDelay: 500,
      defaultTimeout: 1000,
    });
  1. We also ship logs to external source so we had to set wait timeout for 1s for each callback, otherwise twilio function terminates immediately and no logs shipped to external endpoint:
return setTimeout(() =>
          callback(null, getSuccessResponse("SMS", messageSid), 1000)
        );
  1. We also asked to extend timeout on our server-side vendor to wait for 10s from twilio (which is hard limit runtime) and only then timeout but with retries this probably does not make sense anymore.

Mostly timeout/retries for twilio client solved our issues because now we get a proper response from twilio client instantly and it does not hit a hard limit of 10s and runtime does not timeout without any response in case phone number is blocked or combination of twilio sender and receive is not allowed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: community enhancement feature request not on Twilio's roadmap
Projects
None yet
Development

No branches or pull requests

2 participants