TypeError: source.on is not a function
See original GitHub issueWhen trying to send a message I get an error: TypeError: source.on is not a function
.
Version: 3.31.0
Code Snippet
twilio.messages.create({
"to": "+18009876543", // I changed the phone number for this issue
"from": "+18001234567", // I changed the phone number for this issue
"body": "Hello World"
}).then((message) => resolve(message)).catch((error) => reject(error));
Exception/Log
TypeError: source.on is not a function
at Function.DelayedStream.create (/Users/charliefish/Desktop/MyApp/node_modules/delayed-stream/lib/delayed_stream.js:33:10)
at FormData.CombinedStream.append (/Users/charliefish/Desktop/MyApp/node_modules/combined-stream/lib/combined_stream.js:44:37)
at FormData.append (/Users/charliefish/Desktop/MyApp/node_modules/form-data/lib/form_data.js:74:3)
at appendFormValue (/Users/charliefish/Desktop/MyApp/node_modules/request/request.js:326:21)
at Request.init (/Users/charliefish/Desktop/MyApp/node_modules/request/request.js:337:11)
at new Request (/Users/charliefish/Desktop/MyApp/node_modules/request/request.js:127:8)
at request (/Users/charliefish/Desktop/MyApp/node_modules/request/index.js:53:10)
at RequestClient.request (/Users/charliefish/Desktop/MyApp/node_modules/twilio/lib/base/RequestClient.js:78:3)
at Twilio.request (/Users/charliefish/Desktop/MyApp/node_modules/twilio/lib/rest/Twilio.js:241:26)
at Api.Domain.request (/Users/charliefish/Desktop/MyApp/node_modules/twilio/lib/base/Domain.js:34:22)
at V2010.Version.request (/Users/charliefish/Desktop/MyApp/node_modules/twilio/lib/base/Version.js:45:23)
at V2010.Version.create (/Users/charliefish/Desktop/MyApp/node_modules/twilio/lib/base/Version.js:125:24)
at Function.create (/Users/charliefish/Desktop/MyApp/node_modules/twilio/lib/rest/api/v2010/account/message.js:122:33)
at Promise (/Users/charliefish/Desktop/MyApp/index.js:283:19)
at new Promise (<anonymous>)
at sendSMS (/Users/charliefish/Desktop/MyApp/index.js:270:9)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
TypeError: source.on is not a function · Issue #2366 - GitHub
I'm trying to POST an array of values to a HTTP endpoint, and this is the error I receive: TypeError: source.on is not...
Read more >Getting ERROR: uncaughtException: source.on is not a ...
When you call createFormData with myJson as parameter, you will see exception source.on is not a function ! And we keep thinking where...
Read more >Error Received: Source.on is not a function - App Platform
Hello Team, I am trying to create a ticket in Freshdesk along with attachments, but I am getting an error. The Error is:...
Read more >TypeError: source.on is not a function - Web Developer Forum
“TypeError: source.on is not a function” My complete code: I have an index.js file, created automatically, and not modified
Read more >TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I just realized this occurs when the
to
property was set to an object. Seems like Twilio should still handle this error better and give a more descriptive error message.The error is now better surfaced after the migration to axios as the underlying request client in version
3.41.0
: https://github.com/twilio/twilio-node/pull/542.Closing as resolved.