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 分鐘
- 30 天內合併 PR
- 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
貢獻指南
研究方向
從提供的 TypeScript 測試案例以及 node_modules/cookie/index.js:174 和 express/lib/response.js:853 處的堆疊追蹤開始;將相依套件的行為與相關的 Express issue #3958 進行比較。使用 firebase-tools 8.0.0 重現,並確認 res.cookie 接受 sameSite: 'none',且在沒有 TypeError 的情況下發出預期的 cookie。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- express, firebase, node.js, typescript
- 領域
- api, backend
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100