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

🐛 Bug Report: Discord SSO #302

Closed
ukdaaan opened this issue Oct 29, 2023 · 13 comments · Fixed by #323
Closed

🐛 Bug Report: Discord SSO #302

ukdaaan opened this issue Oct 29, 2023 · 13 comments · Fixed by #323
Labels
bug Something isn't working

Comments

@ukdaaan
Copy link

ukdaaan commented Oct 29, 2023

👟 Reproduction steps

Enable the Discord SSO with correct callback urls

👍 Expected behavior

SSO process should complete without issues. (Other IDPs are working as expected without issues)

👎 Actual Behavior

SSO fails to link accounts with error 500, docker console logs below.

[Nest] 45  - 10/29/2023, 6:34:12 PM   ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'password')
TypeError: Cannot read properties of undefined (reading 'password')
    at UserController.getCurrentUser (/opt/app/backend/dist/src/user/user.controller.js:32:38)
    at /opt/app/backend/node_modules/@nestjs/core/router/router-execution-context.js:38:29
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[Nest] 45  - 10/29/2023, 6:34:16 PM   ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'password')
TypeError: Cannot read properties of undefined (reading 'password')
    at UserController.getCurrentUser (/opt/app/backend/dist/src/user/user.controller.js:32:38)
    at /opt/app/backend/node_modules/@nestjs/core/router/router-execution-context.js:38:29
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[Nest] 45  - 10/29/2023, 6:34:16 PM   ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'password')
TypeError: Cannot read properties of undefined (reading 'password')
    at UserController.getCurrentUser (/opt/app/backend/dist/src/user/user.controller.js:32:38)
    at /opt/app/backend/node_modules/@nestjs/core/router/router-execution-context.js:38:29
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[Nest] 45  - 10/29/2023, 6:34:18 PM   ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'password')
TypeError: Cannot read properties of undefined (reading 'password')
    at UserController.getCurrentUser (/opt/app/backend/dist/src/user/user.controller.js:32:38)
    at /opt/app/backend/node_modules/@nestjs/core/router/router-execution-context.js:38:29
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[Nest] 45  - 10/29/2023, 6:34:19 PM   ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'password')
TypeError: Cannot read properties of undefined (reading 'password')
    at UserController.getCurrentUser (/opt/app/backend/dist/src/user/user.controller.js:32:38)
    at /opt/app/backend/node_modules/@nestjs/core/router/router-execution-context.js:38:29
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[Nest] 45  - 10/29/2023, 6:34:23 PM   ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'password')
TypeError: Cannot read properties of undefined (reading 'password')
    at UserController.getCurrentUser (/opt/app/backend/dist/src/user/user.controller.js:32:38)
    at /opt/app/backend/node_modules/@nestjs/core/router/router-execution-context.js:38:29
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[Nest] 45  - 10/29/2023, 6:34:24 PM   ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'password')
TypeError: Cannot read properties of undefined (reading 'password')
    at UserController.getCurrentUser (/opt/app/backend/dist/src/user/user.controller.js:32:38)
    at /opt/app/backend/node_modules/@nestjs/core/router/router-execution-context.js:38:29
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[Nest] 45  - 10/29/2023, 6:34:24 PM   ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'password')
TypeError: Cannot read properties of undefined (reading 'password')
    at UserController.getCurrentUser (/opt/app/backend/dist/src/user/user.controller.js:32:38)
    at /opt/app/backend/node_modules/@nestjs/core/router/router-execution-context.js:38:29
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[Nest] 45  - 10/29/2023, 6:34:35 PM   ERROR [ExceptionsHandler] 
Invalid `this.prisma.oAuthUser.create()` invocation in
/opt/app/backend/dist/src/oauth/oauth.service.js:77:37
  74         `provider_${provider}`,
�������
  75     ]);
  76 }
→ 77 await this.prisma.oAuthUser.create({
       data: {
         userId: "bc026ba0-b75a-4eea-9200-d2349a8203f7",
         provider: "discord",
         providerUsername: undefined,
     +   providerUserId: String
       }
     })
Argument `providerUserId` is missing.
PrismaClientValidationError: 
Invalid `this.prisma.oAuthUser.create()` invocation in
/opt/app/backend/dist/src/oauth/oauth.service.js:77:37
  74         `provider_${provider}`,
�������
  75     ]);
  76 }
→ 77 await this.prisma.oAuthUser.create({
       data: {
         userId: "bc026ba0-b75a-4eea-9200-d2349a8203f7",
         provider: "discord",
         providerUsername: undefined,
     +   providerUserId: String
       }
     })
Argument `providerUserId` is missing.
    at Ur (/opt/app/backend/node_modules/@prisma/client/runtime/library.js:115:5803)
    at zr.handleRequestError (/opt/app/backend/node_modules/@prisma/client/runtime/library.js:122:8007)
    at zr.handleAndLogRequestError (/opt/app/backend/node_modules/@prisma/client/runtime/library.js:122:7697)
    at zr.request (/opt/app/backend/node_modules/@prisma/client/runtime/library.js:122:7307)
    at async OAuthService.link (/opt/app/backend/dist/src/oauth/oauth.service.js:77:9)
    at async OAuthController.callback (/opt/app/backend/dist/src/oauth/oauth.controller.js:53:13)

🌐 Browser

Firefox & Safari (MacOS)

@ukdaaan ukdaaan added the bug Something isn't working label Oct 29, 2023
@stonith404
Copy link
Owner

@zz5840 Do you maybe know why this occurs?

@zz5840
Copy link
Contributor

zz5840 commented Oct 30, 2023

@stonith404 I'll look in it now.

@zz5840
Copy link
Contributor

zz5840 commented Oct 30, 2023

@ukdaaan Could you please go to your discord settings page, take a screenshot of your account info? (You can obscure your privacy and show only the field names)

@ukdaaan
Copy link
Author

ukdaaan commented Oct 31, 2023 via email

@zz5840
Copy link
Contributor

zz5840 commented Nov 1, 2023

@ukdaaan Your account info, as shown below:
image

@ukdaaan
Copy link
Author

ukdaaan commented Nov 2, 2023

Hey, please see the below
Screenshot 2023-11-02 at 20 08 18

@zz5840
Copy link
Contributor

zz5840 commented Nov 2, 2023

@ukdaaan I see, it seems that the provider can't get both user id and user name. Does this bug affect only your account or all accounts in your app? Could you please try to create a new account in your app and link your discord account to it?

@ukdaaan
Copy link
Author

ukdaaan commented Nov 5, 2023

It seems that it affects multiple accounts within my instance.

@zz5840
Copy link
Contributor

zz5840 commented Nov 5, 2023

@ukdaaan Sorry, but I can't get any helpful information from the error log, maybe more sensitive information is needed. If you're willing to help me locate the bug, please join my discord server so that I can take a deeper look in it.

@stonith404
Copy link
Owner

@ukdaaan It should be fixed. Can you try the image stonith404/pingvin-share:development?

@ukdaaan
Copy link
Author

ukdaaan commented Nov 10, 2023

Apologies for the delay in responding, I'll give this a shot this evening.

@ukdaaan
Copy link
Author

ukdaaan commented Nov 10, 2023

@stonith404 I can confirm the fix in the development branch resolves this issue.

@stonith404
Copy link
Owner

Great, the fix will be released ASAP. Make sure to switch back to the latest image as soon as the newest release is released.

CC: @zz5840

stonith404 pushed a commit that referenced this issue Nov 11, 2023
* fix(oauth): github and discord login error
fixed #322, fixed #302

* feat(oauth): print log when ErrorPageException occurs

* refactor(oauth): migrate to Logger

* feat(oauth): add logger for OAuthExceptionFilter

* docs(oauth): update oauth login docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants