Skip to content
Back

Cookie Question

  • 0
  • Auth
  • Web
  • Cloud
mort
18 Nov, 2024, 23:22

I am currently working on a SvelteKit project that utilizes server-side rendering with 'node-appwrite' sdk. In this project, I have implemented a page that requires real-time functionality and have disabled SSR for this particular route and use the client-side 'appwrite' sdk. While the realtime subscription works as expected in the development environment, it encounters a 401 Unauthorized error when deployed to the staging environment.

Upon examining the request and response logs, I have noticed a discrepancy in the cookie handling between the two environments:

In development: A cookie named a_session_[random letters/numbers]_legacy=[token] is present, but not listed under cookies in the storage tab of developer tools is sent in the request. The token value matches the cookie set at login (e.g., my-custom-name=[token]) In staging: The cookie name matches exactly what is set during login (e.g., my-custom-name=[token]). The token value also remains consistent across requests.

I am seeking clarification on the following points:

What is the origin of the a_session_ prefix used in the development environment? Why does this prefix not appear in the staging environment? Is there any configuration or setting that could be causing this difference in behavior? Any insights into this issue would be greatly appreciated, as resolving this discrepancy is crucial for ensuring consistent functionality across the development and staging environments.

TL;DR
Developers having discrepancies between cookie handling in a SvelteKit project with server-side rendering disable for real-time functionality between development and staging environments. In development, a session cookie with a prefix 'a_session_' is present, while staging has a different cookie name. Looking for clarification on this issue and potential solutions. Solution: Check for any configuration differences between the environments that might affect cookie handling.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more