Help Needed: 404 Errors on Page Refresh After Deploying to Vercel (Probably Cookie-Auth-API Related)
- 0
- Auth
- Web
- Cloud

Good afternoon, everyone. I need help solving the following error that I still can't quite identify, but I hope you can help me understand what might be happening.
I managed to get my page running locally. When I run npm run dev, it works perfectly, but when I deployed it on Vercel, I have 404 error issues when I try to refresh a page.
What I've noticed is that I can do everything as long as I don't refresh the page and keep the cookieFallback generated by createEmailPasswordSession. Somehow, that cookie is always at the root, at "/", and there's no problem there—I can always go back and refresh. However, when I navigate and refresh, it gives a 404 error.
I've been researching the documentation and several official videos from the Appwrite YouTube channel, but I haven't found anything very up-to-date on how to do SSR, if that has anything to do with the problem I'm having. In one of the videos, I saw them set a setKey in a Client, which tells me it can't be done, and everywhere it says it's not appropriate to do so. Therefore, I am quite lost on how to proceed. My intuition tells me that ensuring the cookie is always in the browser would solve this problem.
The other alternative I tried was to check if I am verified every time I go to a new page within my site. This seemed to solve the problem, but it added a new issue where every time the page loaded, it took quite a while, presumably because it had to make the request and that takes time. The cookie path was faster.
I welcome any kind of help; everything is appreciated. I am extremely lost on this but have this project quite advanced and am very excited to see it working. Solving this would be incredible, and learning more about it even more so!
Thanks to everyone in advance.
I am attaching images of my code so you can see how I am handling things so far:

Recommended threads
- Auth Error
"use client"; import { useEffect } from "react"; import { getSessionCookie } from "@/actions/auth"; import { createBrowserSessionClient } from "@/lib/appwrite-...
- Prevent modifying specific attributes
How do I prevent user to only to be able to modify some of the attributes. Document level security gives full access to update whole document, what are the wor...
- Bypass Error When Creating Account With ...
Suppose user first uses email/pass for log in using xyz@gmail.com, few month later on decides to use google oauth2 with same xyz@gmail.com (or in reverse orde...
