firebase / firebase/firebase-functions
res.cookie option with sameSite 'none' throws TypeError: option sameSite is invalid at Object.serialize
- 主要言語
- TypeScript
- スター
- 1.1k
- フォーク
- 232
- 平均マージ
- 20時間 46分
- マージ済み PR(30日)
- 15
説明
### Related issues
I found the issue for Express framework
https://github.com/expressjs/express/issues/3958
and looks it was fixed there.
### [REQUIRED] Version info
node: v10.16.3
**firebase-tools:**
8.0.0.
### [REQUIRED] Test case
export const sameSiteCookie = functions.https.onRequest((req, res) => {
cors(req, res, () => {
const expiresIn = 60 * 60 * 24 * 5 * 1000;
const options: any = {
maxAge: expiresIn,
httpOnly: true,
secure: true,
sameSite: 'none',
};
res.cookie('testCKI', 'value123', options);
res.end(JSON.stringify({
data: {
status: 'success'
}
}));
});
});
### [REQUIRED] Steps to reproduce
calling the cloud function above
### [REQUIRED] Expected behavior
set cookie value to SameSite=Never
### [REQUIRED] Actual behavior
TypeError: option sameSite is invalid at Object.serialize (/worker/node_modules/cookie/index.js:174:15) at ServerResponse.res.cookie (/worker/node_modules/express/lib/response.js:853:36) at cors (/srv/lib/index.js:106:13) at cors (/srv/node_modules/cors/lib/index.js:188:7) at /srv/node_modules/cors/lib/index.js:224:17 at originCallback (/srv/node_modules/cors/lib/index.js:214:15) at /srv/node_modules/cors/lib/index.js:219:13 at optionsCallback (/srv/node_modules/cors/lib/index.js:199:9) at corsMiddleware (/srv/node_modules/cors/lib/index.js:204:7) at exports.sessionLogin.functions.https.onRequest (/srv/lib/index.js:98:5)
### Were you able to successfully deploy your functions?
no error messages seen
コントリビューションガイド
調査の方向性
Start with the supplied TypeScript test case and the stack trace at node_modules/cookie/index.js:174 and express/lib/response.js:853; compare the dependency behavior with related Express issue #3958. Reproduce with firebase-tools 8.0.0 and confirm that res.cookie accepts sameSite: 'none' and emits the expected cookie without the TypeError.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- express, firebase, node.js, typescript
- 領域
- api, backend
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100