svelte-adapter-firebase icon indicating copy to clipboard operation
svelte-adapter-firebase copied to clipboard

feat: Add a note about cookies in documentation

Open axel-rock opened this issue 2 years ago • 1 comments

Describe the problem

I suggest adding a word about cookies.

This is not per say a svelte-adapter-firebase issue, but it took me days of investigating why my cookies were working locally, but not live.

The solution was fairly simple, but buried deep inside Firebase's documentation.

Describe the proposed solution

Write a short paragraph under Caveats about the single cookie name that's allowed to be passed to your SSR function, and it is: __session

It is documented here: https://firebase.google.com/docs/hosting/manage-cache#using_cookies

Copy suggestion:

Cookies: When using Firebase Hosting together with Cloud Functions, cookies are stripped from incoming requests. Only the specially-named __session cookie is permitted to pass through to the execution of your app. Source: Firebase documentation

Alternatives considered

One even greater alternative would be to trigger a warning in the console when trying to access an other cookie from the server. I managed to get some cookies across in some occasions, not sure if it's worth implementing.

Importance

would make my life easier

axel-rock avatar Jan 30 '23 02:01 axel-rock

I agree that it's not really an issue for this adapter, and more something you have to know about Firebase CDN. But still, thanks for pointing it out @axel-rock. This solved the flakiness of my cookies in production.

troelsmunk avatar Apr 22 '23 19:04 troelsmunk