firebase / firebase/apphosting-adapters

res.locals is always empty

Open
#67 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
478
Forks
1.5k
Avg merge
3d 22h
Merged PRs (30d)
2

Description

The docs say: https://github.com/FirebaseExtended/firebase-framework-tools#optional-integrate-with-firebase-authentication

> The web framework-aware Firebase deployment tooling automatically keeps client and server state in sync using cookies. The Express res.locals object will optionally contain an authenticated Firebase App instance (firebaseApp) and the currently signed in user (currentUser).

However, when I try to get the `res.locals` in any deployment (either through Firebase Hosting, `firebase emulators:start` or `npm run dev:ssr`), the `res.locals` in `server.ts` is always empty, even though I ran `firebase experiments:enable webframeworks` and `firebase init hosting`. Is there anything I'm missing?

Also, it would be amazing if there could be a super minimal sample app with minimal configuration that shows the entire flow, as it's also unclear how to e.g. then inject it into the module via the REQUEST token.

Contributor guide

Open the contributing guide

Research direction

Start with the server.ts entry point and the optional Firebase Authentication documentation linked in the issue. Reproduce the empty res.locals behavior in Firebase Hosting, firebase emulators:start, or npm run dev:ssr, then determine the expected REQUEST-token integration and document or demonstrate the complete flow with a minimal sample.

Written by the indexing model from the issue text.

Assessment

Tech stack
express, firebase, typescript
Domain
authentication, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.