-
Notifications
You must be signed in to change notification settings - Fork 521
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
TypeError [ERR_INVALID_ARG_TYPE] webhook when the request type is application/json #617
Comments
Hello @neekey, Thank you for taking the time to report this! I was able to reproduce this error locally. This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog. With best regards, Elmer |
+1 I'm having this issue in production on Heroku. Was working fine, and then just cropped up after I sanitized phone numbers to be formatted like this: +13334445555, which I thought was the ideal format. It works from localhost. I double checked my config vars and they are correct in production. Not sure why it would be different in production than in local. twilio.messages
.create({
body: `Here\'s your code: ${user.twoFactorAuthToken}. It expires in 10 minutes.`,
from: process.env.TWILIO_SENDER_NUMBER,
to: user.phone
})
.then(message => console.log("Twilio sent: ", message.sid))
.catch(err => console.log("Twilio error: ", err));
I updated to "twilio": "^3.72.0" and still not working. |
Anyone have an answer to this? https://stackoverflow.com/questions/70560702/twilio-error-typeerror-err-invalid-arg-type-the-key-argument-must-be-of-ty |
@thinkingserious This problem is still blocking my production sending SMS's. Any progress? |
Still busted |
I'm having issue in production with it. Any progress? |
Fixed by #665 |
Issue Summary
I was using Twilio Studio setting up an appointment reminder, for the confirmation widget, I setup the request and content as below:
and my server code is simply like below:
When the confirmation callback hit my server, Twilio webhook throws:
I checked the twilio source code, mainly caused by this function:
obviously if the request type is application/json, express will parse the request.body to an object right away, which causes the issue.
By changing the request type to "Form URL Encoded" fixes my issue:
Steps to Reproduce
Technical details:
The text was updated successfully, but these errors were encountered: