Version 8.2.1 cookie validation regression
- Dominant language
- JavaScript
- Stars
- 21
- Forks
- 27
- PR merge metrics
- No merged PRs in 30d
Description
### Runtime
node.js
### Runtime version
22.17.0
### Module version
8.2.1
### Last module version without issue
8.2.0
### Used with
serverless-offline
### Any other relevant information
Suddenly, I started getting errors "Invalid cookie value". Upon further investigation it turned out to be the newest version 8.2.1 of this package.
### What are you trying to achieve or the steps to reproduce?
I'm generating the cookie from a jwt with a "cookie" npm package.
The resulting cookie looks like the following:
`authToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJmQWRGdjVDZGVleTlZS0tNMiIsImlhdCI6MTc2MjQzMjc2NCwiZXhwIjoxNzYyNDMyOTQ0fQ.BNcdM1iEqB9HfTbSZqDqmErlcV-1nN4kds8xDMdHuGA; Max-Age=180; Path=/; SameSite=Lax`
```js
cookie.serialize(name, value, {
path: '/',
sameSite: 'lax',
secure: isSecure,
...(domain && { domain }),
...options,
}
```
### What was the result you got?
```
[Webpack] Watch service...Debug: internal, implementation, error
Error: Invalid cookie value: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJmQWRGdjVDZGVleTlZS0tNMiIsImlhdCI6MTc2MjQzMjc2NCwiZXhwIjoxNzYyNDMyOTQ0fQ.BNcdM1iEqB9HfTbSZqDqmErlcV-1nN4kds8xDMdHuGA; Max-Age=180; Path=/; SameSite=Lax
at exports.Definitions.format (/Users/admin/projects/monohive/common/temp/node_modules/.pnpm/@hapi+statehood@8.2.1/node_modules/@hapi/statehood/lib/index.js:272:28)
at async exports.state (/Users/admin/projects/monohive/common/temp/node_modules/.pnpm/@hapi+hapi@21.4.4/node_modules/@hapi/hapi/lib/headers.js:94:22)
at async internals.marshal (/Users/admin/projects/monohive/common/temp/node_modules/.pnpm/@hapi+hapi@21.4.4/node_modules/@hapi/hapi/lib/transmit.js:41:9)
at async exports.send (/Users/admin/projects/monohive/common/temp/node_modules/.pnpm/@hapi+hapi@21.4.4/node_modules/@hapi/hapi/lib/transmit.js:27:9)
at async Request._reply (/Users/admin/projects/monohive/common/temp/node_modules/.pnpm/@hapi+hapi@21.4.4/node_modules/@hapi/hapi/lib/request.js:456:9
```
### What result did you expect?
No "Invalid cookie value" error
Contributor guide
Assessment
This issue has not been assessed yet.