KindeK
Kinde5mo ago
Paul E

UnhandledPromiseRejection on login redirect with SvelteKit

Hello KindeAuth Team,

I request your help getting the login redirect to work.

I am trying to Redirect to a different page upon login, but receive an UnhandledPromiseRejection error.
My other normal redirects within the application work normally.

When I remove the redirect URL from Kinde's "Allowed callback URLs" the error goes way, but I get redirected to the home page.

Tech: NodeJs 24.4.1, SvelteKit 5, latest KindeAuth

"svelte": "^5.37.1",
"@sveltejs/kit": "^2.26.1",
"@kinde-oss/kinde-auth-sveltekit": "^2.2.2",
"@kinde/webhooks": "^1.0.0",
"@kitql/handles": "^0.3.0",
"@inlang/cli": "^3.0.12",
"@inlang/paraglide-js": "2.2.0",
etc.

I receive the following error:

node:internal/process/promises:392
      new UnhandledPromiseRejection(reason);
      ^

UnhandledPromiseRejection: 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 "#<Redirect>".
    at throwUnhandledRejectionsMode (node:internal/process/promises:392:7)
    at processPromiseRejections (node:internal/process/promises:475:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:106:32) {
  code: 'ERR_UNHANDLED_REJECTION'
}


Here is my login link with the problematic redirect:
<a href="/api/auth/login?post_login_redirect_url=/myother/testpage">
Login
</a>
`

I will post the request of the code in the next posting.

I tried quite a few fixes and searched online, but I have yet to find a solution that works.

Much appreciate your support and help!
  • Paul
Was this page helpful?