Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access_denied (Cannot read property ‘userRole’ of undefined) #601

Closed
Rohit0301 opened this issue Feb 24, 2022 · 2 comments
Closed

Access_denied (Cannot read property ‘userRole’ of undefined) #601

Rohit0301 opened this issue Feb 24, 2022 · 2 comments

Comments

@Rohit0301
Copy link

I am getting this error when i am calling auth0.getAccessToken(req,res) 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)

@adamjmcgrath
Copy link
Contributor

Hi @Rohit0301 👋

/data/sandbox/node12/node_modules/auth0-authz-rules-api

You have a custom rule that is throwing an error, take a look at setRolesToUser in your custom rule

@adamjmcgrath
Copy link
Contributor

Closing, feel free to ping me if you need me to reopen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants