ruimarinho / authy-client

A complete Authy client with support for TOTP, OneTouch, Phone Verification and Phone Intelligence APIs
122 stars 27 forks source link

AssertionFailedError on startPhoneVerification #52

Closed phiresky closed 5 years ago

phiresky commented 5 years ago

This happens for around 100 different numbers each day from many different countries (CA, FR, AU)

Sometimes carrier is null, sometimes it is not there at all, sometimes is_phonenumber is missing.

Example:

2018-11-27 13:47:27: send_phone_verification { country: 'FR', phone: 'XXXX' } { AssertionFailedError: 500 Internal Server Error
    at assert (node_modules/authy-client/dist/src/validator.js:60:11)
    at Client.rpc.postAsync.bind.then.tap.response (node_modules/authy-client/dist/src/client.js:750:31)
  message: 'Internal Server Error',
  data: 
   { message: 'SMS envoyé à +33 XXXXX.',
     seconds_to_expire: 599,
     uuid: 'XXXXX',
     success: true },
  errors: 
   { carrier: 
      { __class__: 'Violation',
        assert: [Object],
        value: [Object],
        violation: [Object] },
     is_cellphone: 
      { __class__: 'Violation',
        assert: [Object],
        value: [Object],
        violation: [Object] } },
  name: 'AssertionFailedError',
  code: 500 }

and another one:

  message: 'Internal Server Error',
  data: 
   { carrier: null,
     is_cellphone: true,
     message: 'SMS inviato a +39 XXXX',
     seconds_to_expire: 599,
     uuid: 'XXXXX',
     success: true },
  errors: { carrier: [ [Object] ] },
  name: 'AssertionFailedError',

This might have something to do with:

https://support.twilio.com/hc/en-us/articles/360004563433

ZiNai commented 5 years ago

image

I have the same problem.when I sent to CN , its ok ,but sent to CA its tell me 'Internal Server Error'. But the details are 'success'.

I have to wrap node-authy api. Maybe you can use it. @phiresky

ReguloSarmiento commented 5 years ago

Any update on this issue? I have the same problem with IE, UK.

{ AssertionFailedError: Internal Server Error
    at assert (/user_code/node_modules/authy-client/dist/src/validator.js:60:11)
    at Client.rpc.postAsync.bind.then.tap.response (/user_code/node_modules/authy-client/dist/src/client.js:750:31)
    at PassThroughHandlerContext.finallyHandler (/user_code/node_modules/bluebird/js/release/finally.js:57:23)
    at PassThroughHandlerContext.tryCatcher (/user_code/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/user_code/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/user_code/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/user_code/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/user_code/node_modules/bluebird/js/release/promise.js:694:18)
    at Promise._fulfill (/user_code/node_modules/bluebird/js/release/promise.js:638:18)
    at Promise._resolveCallback (/user_code/node_modules/bluebird/js/release/promise.js:432:57)
    at Promise._settlePromiseFromHandler (/user_code/node_modules/bluebird/js/release/promise.js:524:17)
    at Promise._settlePromise (/user_code/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/user_code/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/user_code/node_modules/bluebird/js/release/promise.js:694:18)
    at Promise._fulfill (/user_code/node_modules/bluebird/js/release/promise.js:638:18)
    at Request._callback (/user_code/node_modules/bluebird/js/release/nodeback.js:45:21)
  message: 'Internal Server Error',
  data: 
   { message: 'Text message sent to +44 XXXXXXXX.',
     seconds_to_expire: 599,
     uuid: '057c4bf0-56e8-0137-003f-0e7944cc8984',
     success: true },
  errors: 
   { carrier: 
      { __class__: 'Violation',
        assert: [Object],
        value: [Object],
        violation: [Object] },
     is_cellphone: 
      { __class__: 'Violation',
        assert: [Object],
        value: [Object],
        violation: [Object] } },
  name: 'AssertionFailedError',
  code: 500 } 
ruimarinho commented 5 years ago

These validations will have to be relaxed then. You would expect a boolean which is referenced on their API docs to either be true or false 🤷‍♂️