Closed Vaib215 closed 1 month ago
Hi could you explain at what stage the error was showing? Your URL is no longer use Kinde to check.
I did change the auth from kinde to clerk. The error was visible sometimes before login, sometimes after login
@Vaib215 it's hard to assist here, not much to go on. Are you able to provide some code or deploy with Kinde auth for me to check out?
I'm also running into a similar issue.
Works locally, but when deployed to vercel it's failing, and this is the only useful log I could find.
[GET] /api/auth/login?nxtPkindeAuth=login status=500
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Unhandled Rejection: Error: NEXT_REDIRECT
All I have in my /api/auth/[kindeAuth]/route.ts
is this
import { handleAuth } from '@kinde-oss/kinde-auth-nextjs/server';
export const GET = handleAuth();
I've made sure my env vars point to the production URL, and not localhost
.
Okay so I've done a little more digging, and turns out the my problem was the fact that I was using Sentry...
I still believe there's a change required from Kinde SDK's side.
In NextJS, the redirect
method simply throws a NEXT_REDIRECT
Error, which is caught, and subsequently actioned. Which is why if/when we use Sentry, Kinde's attempt to redirect is caught by Sentry's Middleware causing the 500.
I think a solution here might be to use NextRedirect instead of redirect here, which is how API routes should redirect I believe.
For anyone wondering, the solution is:
// next.config.js
export default withSentryConfig(config, {
...
// https://github.com/kinde-oss/kinde-auth-nextjs/issues/169#issuecomment-2133396389
excludeServerRoutes: [new RegExp('/api/auth/.*')],
});
@AntoLepejian Could you please try version 2.2.14-0
and let me know if this resolves the issue please?
@AntoLepejian Could you please try version
2.2.14-0
and let me know if this resolves the issue please?
@DanielRivers this was actually resolved in 2.2.12 since my suggestion was implemented in #173 🙌🏼
Great! :)
Prerequisites
Describe the issue
I launched my product with kinde's auth here: https://the-abc.tech I did most of the things correctly.
Library URL
https://github.com/kinde-oss/kinde-auth-nextjs/
Library version
2.2.5
Operating system(s)
macOS
Operating system version(s)
14.4.1
Further environment details
No response
Reproducible test case URL
https://the-abc.tech
Additional information
No response