Auth0 Home Blog Docs

Webtask for auth0-authy-sample-app failing due to undefined body on the context


#1

The Authy MFA sample, which may be out of date, croaks when attempting to execute OTP verification. I suspect this has to do with how context is constructed before dispatch to the webtask, but I’m not comfortable enough with Auth0’s MFA workflow to determine why context.body is undefined and where context is constructed in the first place.

Any help would be appreciated:

function(callback) {
      if (req.method === 'POST') {

      //change this to authy
      console.log(context);
      request.get('https://api.authy.com/protected/json/verify/' + context.body.otp + '/' + context.body.user_sid,
     {
        qs: {
          api_key: context.data.authy_api_key
        },
      },
      function(err, resp, body){
      ...
      }
  • Error
{
  "code": 500,
  "error": "Script generated an unhandled synchronous exception.",
  "details": "TypeError: Cannot read property 'otp' of undefined",
  "name": "TypeError",
  "message": "Cannot read property 'otp' of undefined",
  "stack": "TypeError: Cannot read property 'otp' of undefined\n    at /data/io/91fa8a1f-dd93-4b2c-a3dc-9da1254f937e/webtask.js:59:80\n    at /data/sandbox/node_modules/async/dist/async.js:3866:24\n    at replenish (/data/sandbox/node_modules/async/dist/async.js:998:17)\n    at iterateeCallback (/data/sandbox/node_modules/async/dist/async.js:983:17)\n    at /data/sandbox/node_modules/async/dist/async.js:958:16\n    at /data/sandbox/node_modules/async/dist/async.js:3871:13\n    at /data/io/91fa8a1f-dd93-4b2c-a3dc-9da1254f937e/webtask.js:43:14\n    at /data/sandbox/node_modules/async/dist/async.js:3866:24\n    at replenish (/data/sandbox/node_modules/async/dist/async.js:998:17)\n    at iterateeCallback (/data/sandbox/node_modules/async/dist/async.js:983:17)"
}

#3

Hey @revprez !

As it has been more than a few months since this topic was opened and there has been no reply or further information provided from the community as to the existence of the issue we would like to check if you are still facing the described challenge?

We are more than happy to assist in any way! If the issue is still out there please let us know so we can create a new thread for better visibility, otherwise we’ll close this one in week’s time.

Thank you!


#4

This topic was automatically closed after 5 days. New replies are no longer allowed.