Auth0 Home Blog Docs

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


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
      request.get('' + context.body.otp + '/' + context.body.user_sid,
        qs: {
      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)"