Twilio api 发送 500 状态 将循环结构转换为 JSON

发布于 2025-01-09 18:06:57 字数 1041 浏览 0 评论 0原文

我正在尝试通过 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深巷少女 2025-01-16 18:06:57

很难说为什么当您通过 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文