Closed kareig closed 1 month ago
going over source i see there are all the undocumented options i could use and will try them: options
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',
});
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,
});
2) 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)
);
3) 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.
Is this still an issue?
hello, we have solved with a simple await
instruction, apparently the app redirected to a new route before that the request was completed
Preflight Checklist
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.
`
`
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 doingaxios
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