Access_denied (Cannot read property 'userRole' of undefined)

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)

Hey there!

What i would suggest here is to raise a GitHub issue in the next.js sdk repo so we can discuss that directly with the repo maintainers. Once you create make sure to share it here with us so we can ping them. Thank you!

Access_denied (Cannot read property ‘userRole’ of undefined) · Issue #601 · auth0/nextjs-auth0 · GitHub i have created a issue here.

1 Like

Perfect! I’ll ping repo maintainers in a few minutes!

@konrad.sopala The problem is solved. thanks for helping :grin:

1 Like

Perfect! Glad to hear that!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.