Skip to content

Commit

Permalink
Merge pull request #9 from kariem/patch-1
Browse files Browse the repository at this point in the history
Fixed '__session' name for Cloud Functions and Cloud Run
  • Loading branch information
hendrysadrak authored Jul 2, 2019
2 parents b3a464e + 16e4d6c commit b496b8b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,26 @@ express() // or connect
} ) );
```

## Usage in Cloud Functions or Cloud Run

When using Firebase Hosting together with Cloud Functions or Cloud Run, cookies are stripped from incoming requests. This would normally prevent the session lookup mechanism from working. However, when using `__session` as the name, the value will be passed through to the app.

```javascript
express() // or connect
.use( session( {
store: new FirestoreStore( {
database: database
} ),

name: '__session', // ← required for Cloud Functions / Cloud Run
secret: 'keyboard cat',
resave: true,
saveUninitialized: true
} ) );
```

Refer to [Using Cookies in the Firebase Documentation on Caching](https://firebase.google.com/docs/hosting/manage-cache#using_cookies)


## Options

Expand Down

0 comments on commit b496b8b

Please sign in to comment.