OAuth Authorization Error - Zendesk OAuth2 API Credential

I guess my issue related to this issue

When I’m trying to connect my zendesk account I am not able to authorize and I’m getting an error.

Here is the error message

{"code":0,"message":"Cannot read properties of undefined (reading 'globalRole')","hint":"","stack":"TypeError: Cannot read properties of undefined (reading 'globalRole')\n    at whereClause (/usr/local/lib/node_modules/n8n/dist/src/CredentialsHelper.js:352:14)\n    at Object.getCredentialForUser (/usr/local/lib/node_modules/n8n/dist/src/CredentialsHelper.js:361:16)\n    at /usr/local/lib/node_modules/n8n/dist/src/Server.js:1120:45\n    at Layer.handle [as handle_request] (/usr/local/lib/node_modules/n8n/node_modules/express/lib/router/layer.js:95:5)\n    at next (/usr/local/lib/node_modules/n8n/node_modules/express/lib/router/route.js:137:13)\n    at Route.dispatch (/usr/local/lib/node_modules/n8n/node_modules/express/lib/router/route.js:112:3)\n    at Layer.handle [as handle_request] (/usr/local/lib/node_modules/n8n/node_modules/express/lib/router/layer.js:95:5)\n    at /usr/local/lib/node_modules/n8n/node_modules/express/lib/router/index.js:281:22\n    at Function.process_params (/usr/local/lib/node_modules/n8n/node_modules/express/lib/router/index.js:341:12)\n    at next (/usr/local/lib/node_modules/n8n/node_modules/express/lib/router/index.js:275:10)\n    at /usr/local/lib/node_modules/n8n/dist/src/UserManagement/routes/index.js:91:9\n    at Layer.handle [as handle_request] (/usr/local/lib/node_modules/n8n/node_modules/express/lib/router/layer.js:95:5)\n    at trim_prefix (/usr/local/lib/node_modules/n8n/node_modules/express/lib/router/index.js:323:13)\n    at /usr/local/lib/node_modules/n8n/node_modules/express/lib/router/index.js:284:7\n    at Function.process_params (/usr/local/lib/node_modules/n8n/node_modules/express/lib/router/index.js:341:12)\n    at next (/usr/local/lib/node_modules/n8n/node_modules/express/lib/router/index.js:275:10)\n    at /usr/local/lib/node_modules/n8n/dist/src/UserManagement/routes/index.js:61:13\n    at Layer.handle [as handle_request] (/usr/local/lib/node_modules/n8n/node_modules/express/lib/router/layer.js:95:5)\n    at trim_prefix (/usr/local/lib/node_modules/n8n/node_modules/express/lib/router/index.js:323:13)\n    at /usr/local/lib/node_modules/n8n/node_modules/express/lib/router/index.js:284:7\n    at Function.process_params (/usr/local/lib/node_modules/n8n/node_modules/express/lib/router/index.js:341:12)\n    at next (/usr/local/lib/node_modules/n8n/node_modules/express/lib/router/index.js:275:10)"}

This is my docker config

docker run -it --rm \
        --name n8n \
        -p 5678:5678 \
        -v ~/.n8n:/home/node/.n8n \
        -e N8N_BASIC_AUTH_ACTIVE=true\
        -e N8N_BASIC_AUTH_USER=hasan\
        -e N8N_BASIC_AUTH_PASSWORD=hasan\
        -e N8N_AUTH_EXCLUDE_ENDPOINTS="rest/oauth2-credential/callback" \
      n8nio/n8n:0.169.0

Note: when I use version 0.167.0 it works

Thanks for opening it here @hasanhw,

At what stage do you see the error message is it as soon as you click connect on the credentials?

@Jon After I click on connect my account attached in the screenshot It opens a new tab tells me to sign in to zendesk and then show the error page with the Traceback

Hey @hasanhw,

That is interesting, We were seeing the other issue as soon as you press connect. I don’t have access to a Zendesk instance to test but I have tagged @MutedJam to see if he can reproduce it.

1 Like

Hi again @Jon, I am experiencing the same issue with ServiceNow

Hey @hasanhw,

Do you get the same issue if you remove the N8N_AUTH_EXCLUDE_ENDPOINTS option, Not sure if it would help with anything but it could be worth trying.

Yes it works without any errors, but unfortunately I need N8N_AUTH_EXCLUDE_ENDPOINTS to be there for my usecase

Hey @hasanhw,

That is handy to know and will help us with trying to reproduce it :slight_smile:

1 Like

Thanks all and I’m so sorry for the trouble. I managed to reproduce the problem using the information provided and shall add it to our internal bug tracker for a fix.

2 Likes

I am experiencing a similar error for the n8n cloud instance [email protected]

I am really sorry to the trouble @Inayet. The team is looking into this and we’ll of course share an update as soon as we have found anything. For the time being you might want to consider rolling back to version 0.167.0. You can do so via the admin panel:

Hey @hasanhw,

Are you using the User Management feature at all and can you share more information about your usecase (I thought you did somewhere but I can’t see it now)?

Hey @Inayet, the team (kudos to @kik00 here) has now implemented a fix for the behaviour on n8n.cloud. I quickly tested this with a bunch of my own accounts and the Oauth2 process seems to work again as expected for me using v0.168.2.

Would you mind testing this on your end and confirm whether you’re still having trouble here?

Hey @Jon

  • We are not currently using the User Management feature.
  • We are trying to build a solution where n8n is secured with basic auth, but we need the OAuth callback endpoint to be public so that all our users have the access to connect different channels.

Sorry for the late reply and let me know if you need further information

Thanks @hasanhw,

I will update our internal ticket for this one :+1:

1 Like

@Jon Can you provide an ETA for the fix?
Thanks in advance

Hey @hasanhw,

I don’t have one at the moment but the team are aware so hopefully it will be a quick one.

1 Like

Hey, just wanted to add that it affects Google OAuth nodes as well.

Hey @fcecagno,

In theory it will impact all oauth credentials if you are using the exclude endpoints environment option.

Are you doing the same thing for the same reason or are you using cloud / something else and seeing the error?

Hi @Jon, I’d like to withdraw my comment, since I tested again and it was fine, so my problem was unrelated to this issue. Sorry about that.

1 Like