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

Simple Mistake - Easy FIX next.js sdk can't get the correct error type of credentials provider #11155

Open
TUTUBIG opened this issue Jun 13, 2024 · 2 comments
Labels
bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

Comments

@TUTUBIG
Copy link

TUTUBIG commented Jun 13, 2024

Environment

System:
    OS: macOS 14.5
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 21.91 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 19.8.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.5.1 - /usr/local/bin/npm
    pnpm: 9.3.0 - /usr/local/bin/pnpm
  Browsers:
    Chrome: 125.0.6422.142
    Safari: 17.5

Reproduction URL

https://github.com/TUTUBIG/nextJs-dashboard

Describe the issue

image when I return null, the caller always get CallbackRouteError error

I already found the issue, but need you guys to fix it.
in your code auth/core/src/lib/actions/callback/index.ts you throw CredentialsSignin() which extends Error. However in the logic of catch of this error, you will wrapper any error which doesn't extends AuthError with CallbackRouteError. I think you need to fix it to extends AuthError. I paste some picture of this code below

image image image

How to reproduce

Actually I found this issue in the official tutorial project - next.js dashboard
Just login with any email & password, it always return the same error. This is because I can't get the accurate error type from your auth SDK.

Expected behavior

Make the error correct & accurate

@TUTUBIG TUTUBIG added bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. labels Jun 13, 2024
@TUTUBIG TUTUBIG changed the title next.js sdk can't get the correct error type of credentials provider Simple Mistake - Easy FIX next.js sdk can't get the correct error type of credentials provider Jun 13, 2024
@yukinoyuu
Copy link

yukinoyuu commented Jun 14, 2024

The types are broken in #11050

Screenshot 2024-06-14 at 11 31 09 AM

@ndom91
Copy link
Member

ndom91 commented Jun 24, 2024

Yeah thanks, so the idea was actually to provide another error class to extend for custom credentialErrors that doesnt extend AuthError, because that would end up with our messaging appended to the error.messgae, which users didn't want.

Looks like we just have to also not wrap that one here. I'll take a look shortly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Projects
None yet
Development

No branches or pull requests

3 participants