I am getting this error when i am calling auth0.getAccessToken() function in my next.js application
Auth0 logs -
{
“code”: 500,
“error”: “Script generated an unhandled asynchronous exception.”,
“details”: “TypeError: Cannot read property ‘userRole’ of undefined”,
“name”: “TypeError”,
“message”: “Cannot read property ‘userRole’ of undefined”,
“stack”: “TypeError: Cannot read property ‘userRole’ of undefined\n at setRolesToUser (/data/io/node12/d4c3c024-9c8f-4b9a-89e0-06ddf55117cf/webtask.js:41:49)\n at fn (/data/sandbox/node12/node_modules/auth0-authz-rules-api/node_modules/async/lib/async.js:638:34)\n at Immediate. (/data/sandbox/node12/node_modules/auth0-authz-rules-api/node_modules/async/lib/async.js:554:34)\n at processImmediate (internal/timers.js:461:21)\n at process.topLevelDomainCallback (domain.js:138:15)\n at process.callbackTrampoline (internal/async_hooks.js:124:14)”
}
Code generated an uncaught exception: TypeError: Cannot read property ‘userRole’ of undefined
at setRolesToUser (/data/io/node12/d4c3c024-9c8f-4b9a-89e0-06ddf55117cf/webtask.js:41:49)
at fn (/data/sandbox/node12/node_modules/auth0-authz-rules-api/node_modules/async/lib/async.js:638:34)
at Immediate. (/data/sandbox/node12/node_modules/auth0-authz-rules-api/node_modules/async/lib/async.js:554:34)
at processImmediate (internal/timers.js:461:21)
at process.topLevelDomainCallback (domain.js:138:15)
at process.callbackTrampoline (internal/async_hooks.js:124:14)