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

getting "SvelteKitError: Not found: /signin/..-" after updating to svelte 5 #12816

Open
martin-gif opened this issue Mar 26, 2025 · 0 comments
Open
Labels
bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

Comments

@martin-gif
Copy link

Environment

System:
OS: macOS 15.3.1
CPU: (10) arm64 Apple M1 Pro
Memory: 89.30 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.14.0 - /etc/profiles/per-user/marvin/bin/node
Yarn: 1.22.21 - /opt/homebrew/bin/yarn
npm: 10.9.2 - /etc/profiles/per-user/marvin/bin/npm
Browsers:
Safari: 18.3
npmPackages:
@auth/prisma-adapter: ^2.8.0 => 2.8.0
@auth/sveltekit: ^1.7.4 => 1.8.0

Reproduction URL

https://github.com/martin-gif/sveltekit-auth-example

Describe the issue

Nach dem Update auf Svelte 5 mit svelte kit 2 bekommen ich bei einer Clint side 'signIn' den Fehler SvelteKitError: Not found: /signin/keycloak und einen Status '404'. Der Button ist relativ simple:

import { signIn, signOut } from '@auth/sveltekit/client';
<button
 onclick={() => signIn('keycloak')}
>
Login
</button>

hier noch einmal mein src/auth.ts

import { SvelteKitAuth } from '@auth/sveltekit';
import { PrismaAdapter } from '@auth/prisma-adapter';
import { prisma } from '$lib/server/DB';
import Keycloak from '@auth/sveltekit/providers/keycloak';

export const { signIn, signOut, handle } = SvelteKitAuth({
	debug: true,
	adapter: PrismaAdapter(prisma),
	providers: [Keycloak],
	callbacks: {
		session({ session, user }) {
			session.user.id = user.id; // kann man später mal schauen, ob man das angreifen kann
			return session;
		}
	}
});

and src/hooks.server.ts

import { redirect, type Handle } from '@sveltejs/kit';
import { handle as authenticationHandle } from './auth';
import { sequence } from '@sveltejs/kit/hooks';

const authentication: Handle = async ({ event, resolve }) => {
	if (event.url.pathname.endsWith('/feedback')) {
		const session = await event.locals.auth();
		if (!session) {
			throw redirect(303, '/auth/signin');
		}
	}
	return resolve(event);
};

export const handle: Handle = sequence(authenticationHandle, authentication);

i'm still quite new to svelte web development, so unfortunately i can't rule out the possibility that i made the mistake. If there is any information missing, I can provide it. the bug exists in the @auth/sveltekit versions 1.7.3,1.7.4,1.8.0.

How to reproduce

  • Download repo from the link provided
  • install packages (I used Yarn in the repo)
  • start page with vite dev
  • click login button

Expected behavior

the keycloak login page opens and you can log in as a user

@martin-gif martin-gif added bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. labels Mar 26, 2025
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

1 participant