firebase / firebase/firebase-tools

NextJS 14 + Framework hosting: __session cookie not set when deployed

Open
#6,893 0 comments 0 reactions 0 assignees View on GitHub
integration: web frameworks type: bug
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

### [REQUIRED] Environment info

**firebase-tools:** 13.5.1

**Platform:** macOS

### [REQUIRED] Test case

```
"firebase": "^10.9.0",
"firebase-admin": "^12.0.0",
"next": "14.1.2",
```

Logging with link auth working locally and deployed, but the `__session` cookie is not set when the application is deployed. When running locally the cookie gets set.

Sample network requests when running locally shows the __session cookie being set automatically after login
Screenshot 2024-03-19 at 11 06 21 PM

Screenshot 2024-03-19 at 11 06 39 PM

Screenshot 2024-03-19 at 11 06 53 PM

When running the same code on Firebase Hosting no __session cookie is set
Screenshot 2024-03-19 at 11 12 03 PM

### [REQUIRED] Steps to reproduce

Deploy to Firebase Hosting.
Login with link.
Inspect network requets.
Refresh.

### [REQUIRED] Expected behavior

The user should be set by SSR. The session should be available in the `__session` cookie.

### [REQUIRED] Actual behavior

When deployed to firebase Hosting, the user is not set in SSR due to the `__session` cookie not being set. The user state is signed out on page load and the page updates after connecting to Firebase to show the user info.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.