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
- Issue with Authentication
I am stuck with authentication using appwrite. I am getting bad request 400 error when trying to register though we already have project, database, collection c...
- getaddrinfo EAI_AGAIN when using axios
I have this code to make a get request to an API ```javascript function fetchUserListPerPage(page) { return new Promise(async (resolve, reject) => { ...
- Appwrite CLI not working as expected
Until yesterday I was authenticated in my Appwrite instance through the CLI, and I was able to get my functions and deploy them manually. Today, when I went ba...