Twilio api 发送 500 状态 将循环结构转换为 JSON
我正在尝试通过 twiliosing
const accountSid = process.env.accountSid;
const authToken = process.env.authToken;
const client = require('twilio')(accountSid, authToken);
client.messages.create({
to:'+61XXXXXXXXX',
from:'+1XXXXXXXXX',
body:'ahoy hoy! Testing Twilio and node.js'
}, function(error, message) {
if (!error) {
console.log('Success! The SID for this SMS message is:');
console.log(message.sid);
console.log('Message sent on:');
console.log(message.dateCreated);
} else {
console.log(error, 'Oops! There was an error.');
}
}
控制台发送消息,返回
Success! The SID for this SMS message is:
XXXXXXXXXXXXXXXXX
Message sent on:
2022-02-24T05:29:25.000Z
但邮递员给出 500 状态并给出以下错误
Converting circular structure to JSON
--> starting at object with constructor 'Twilio'
| property '_accounts' -> object with constructor 'Accounts'
--- property 'twilio' closes the circle
并且没有收到指定号码的消息。
I am trying to send message through twiliousing
const accountSid = process.env.accountSid;
const authToken = process.env.authToken;
const client = require('twilio')(accountSid, authToken);
client.messages.create({
to:'+61XXXXXXXXX',
from:'+1XXXXXXXXX',
body:'ahoy hoy! Testing Twilio and node.js'
}, function(error, message) {
if (!error) {
console.log('Success! The SID for this SMS message is:');
console.log(message.sid);
console.log('Message sent on:');
console.log(message.dateCreated);
} else {
console.log(error, 'Oops! There was an error.');
}
}
Console returning
Success! The SID for this SMS message is:
XXXXXXXXXXXXXXXXX
Message sent on:
2022-02-24T05:29:25.000Z
But postman giving 500 status and giving following error
Converting circular structure to JSON
--> starting at object with constructor 'Twilio'
| property '_accounts' -> object with constructor 'Accounts'
--- property 'twilio' closes the circle
And not receiving msg on the specified number.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
很难说为什么当您通过 Postman 发送请求时会收到该错误消息。您能分享一下您使用 Postman 的更多细节吗?
我建议按照此处的说明使用 Twilio Postman Collection 。
It's hard to say why you get that error message when you sent a request via Postman. Can you share some more details about the way you used Postman?
I'd recommend using the Twilio Postman Collection as instructed here.