RestException [错误]:请求过多状态:429,代码:20429, [英] RestException [Error]: Too many requests status: 429, code: 20429,

查看:52
本文介绍了RestException [错误]:请求过多状态:429,代码:20429,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

辅助函数下面是我的辅助函数,它做两件事.1.generateotp函数会从req.body向手机发送otp(这里我传递了两个参数手机号码和频道.channel是发送otp的模式,意思是sms或otp,这里是sms)2.secon 函数将验证用户收到的 otp.这里我们也取2个参数手机号码和otp

helper function below is my helper function which do two things. 1.generateotp function will send otp to mobile from req.body(here i pass two parametr mobile number and channel. channel is mode of sending otp means sms or otp here it is sms) 2.secon function will verify the otp which user recived. here also we take 2 parameter mobile number and otp

var db = require('../config/connection');
const config=  require('../config/config');
const collection = require('../config/connection');
const client = require("twilio")(config.accountSID,config.authToken)
module.exports={ 
     generateOtp:(userNumber,channel) => {
        client
        .verify
        .services(config.serviceID)
        .verifications
        .create({
          to:`+91${userNumber}`,
          channel:channel
        })
        .then((data) => {
            console.log(data)
            // return callback(null, 'success');
        })
        .catch((error) => {
            console.log(error);
        });
     },
     
     verifyOtp:(userNumber,userOtp) => {
         client
         .verify
         .services(config.serviceID)
         .verificationChecks
         .create({
            to:`+91$${userNumber}`,
            code:userOtp

         })
         .then((data) => {
             console.log(data);
         })
         .catch((error) => {
             console.llog(error);
         })
     }
}

路线

/Generate Otp
 router.post('/signup',(req,res) => { 
   const {userNumber, channel} = req.body;
    userhelper.generateOtp(userNumber,channel)
    return res.redirect('/verify');
 });
 //Verify Otp
 router.post('/verify',(req,res) => {
   const {userNumber,userOtp} = req.body;
   console.log(req.body);
  // userhelper.verifyOtp(userNumber,userOtp)
 })

我正在使用 twilio verify api 进行手机号码验证,上面的代码运行良好,直到昨天现在测试代码出现错误.

I am using twilio verify api for mobile number verification the above code worked perfectly till yesterday now when is test code i am getting an error.

RestException [Error]: Too many requests
    at success (C:\Users\Alfas Ahmed\Desktop\whatsapp-ecom\node_modules\twilio\lib\base\Version.js:135:15)
    at Promise_then_fulfilled (C:\Users\Alfas Ahmed\Desktop\whatsapp-ecom\node_modules\q\q.js:766:44)
    at Promise_done_fulfilled (C:\Users\Alfas Ahmed\Desktop\whatsapp-ecom\node_modules\q\q.js:835:31)
    at Fulfilled_dispatch [as dispatch] (C:\Users\Alfas Ahmed\Desktop\whatsapp-ecom\node_modules\q\q.js:1229:9)
    at Pending_become_eachMessage_task (C:\Users\Alfas Ahmed\Desktop\whatsapp-ecom\node_modules\q\q.js:1369:30)
    at RawTask.call (C:\Users\Alfas Ahmed\Desktop\whatsapp-ecom\node_modules\asap\asap.js:40:19)
    at flush (C:\Users\Alfas Ahmed\Desktop\whatsapp-ecom\node_modules\asap\raw.js:50:29)
    at processTicksAndRejections (internal/process/task_queues.js:75:11) {
  status: 429,
  code: 20429,
  moreInfo: 'https://www.twilio.com/docs/errors/20429',
  details: undefined
}

推荐答案

如何在不受限的情况下测试 Twilio Verifyhttps://www.twilio.com/blog/test-verify-无速率限制

How to test Twilio Verify without getting rate limited https://www.twilio.com/blog/test-verify-no-rate-limits

这篇关于RestException [错误]:请求过多状态:429,代码:20429,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆