
After getting the user/client's session object in the Sveltekit Server I am trying to take the user/client from sign in page to the main page using throw redirect. I keep getting unhandled error. What should I do? Thanks in advance.

Why do you throw?
throw redirect(303, "/")
On success?

Throw inside then()
will move you to the catch
part.

sorry i did not understand you there (edited) Replying to asfaswrefarfga ON
Send a message in "Sveltekit: Throw Redirect in Promise Error (+page.server.ts)"


This line

Why you throw
?

To take the client from the sign in page to the home page

Ohh I see But the problem is that you're inside a then code So try to this
export async function sign_in(signInObjectArg:any) {
let isLoggedIn = false;
try {
await account.createEmailSession(signInObjectArg.email, signInObjectArg.password);
isLoggednIn = true;
} catch (e) {
console.log(e); // Failure
}
if(isLoggedIn) {
throw redirect(303, "/")
}
}

this doesnt solve it, same error.

You removed the then and you still get the without catch block
?

Maybe you run the sign_in
inside another then()
function?

Sessions can't work properly out of the box with server-side-rendering. This is because Appwrite APIs use cookies to authorize. To have proper SSR integration with Appwrite, you will need to proxy some requests. You can check out this demo and it's GitHub repository to learn more: https://svelte-kit.ssr.almostapps.eu/

how can i switch to another page using sveltekit actions and throw redirect? seems to be working only in hooks, but not form actions

https://discord.com/channels/457912077277855764/1120224491759476767 ->handling throw redirect promise error https://discord.com/channels/457912077277855764/1120309708209786970 ->handling throw redirect forms error

[SOLVED] Sveltekit: Throw Redirect in Promise Error (+page.server.ts)

Hi, I am trying to use the solution provides in the example "almostSSR". I'am new to Appwrite (switching from Supabase). My Question: Is it possible to use this SSR functionality on localhost? At the moment I don't have an DNS Record and for developing i want to work on my Laptop. I am talking about these configs in $lib/AppwriteService.ts.
export const SsrHostname: string = 'svelte-kit.ssr.almostapps.eu';
export const AppwriteHostname: string = 'appwrite.svelte-kit.ssr.almostapps.eu';

please create a new post instead of posting in an old thread 🙏🏼
Recommended threads
- "Memberships privacy" setting in 1.7.4
Hi everyone, I'm experiencing an issue with a clean self-hosted installation of Appwrite version 1.7.4. I previously used version 1.6.1, and if I remember corre...
- Struggling with Sessions
Understanding check: createAnonymousSession() registers the session with the backend setSession() creates a cookie on the user’s computer(?) getSession(‘curr...
- MCP and VSCode Docs
I like your tools, but would like to set up Copilot in VSCode, but these docs don't offer that guide. Did I miss something? https://appwrite.io/docs/tooling/mcp
