-
-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(v8): server action cookie options #617
Conversation
Someone is attempting to deploy a commit to a Personal Account owned by @vvo on Vercel. @vvo first needs to authorize it. |
@renchris had some conflicts given the repo changes I have done, can you double check now? |
Hey @vvo. The merged commit looks all good! However, when I am trying to set up the new current v8 branch I get an error on install I tried and fails:
Ran the repository set up commands again fnm install
corepack enable
pnpm install Fails upon pnpm install
Scope: all 6 workspace projects
Lockfile is up to date, resolution step is skipped
Packages: +784
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 784, reused 784, downloaded 0, added 784, done
devDependencies:
+ @release-it/conventional-changelog 7.0.2
+ @types/cookie 0.5.3
+ @types/node 20.8.7
+ @typescript-eslint/eslint-plugin 6.8.0
+ @typescript-eslint/parser 6.8.0
+ c8 8.0.1
+ cookie 0.5.0
+ eslint 8.51.0
+ eslint-config-prettier 9.0.0
+ eslint-import-resolver-node 0.3.9
+ eslint-import-resolver-typescript 3.6.1
+ eslint-plugin-import 2.28.1
+ eslint-plugin-prettier 5.0.1
+ iron-webcrypto 1.0.0
+ prettier 3.0.3
+ prettier-plugin-packagejson 2.4.6
+ publint 0.2.4
+ release-it 16.2.1
+ tsup 7.2.0
+ tsx 3.14.0
+ typescript 5.2.2
. prepare$ pnpm build
│ > [email protected] build /iron-session
│ > tsc --noEmit && tsup
│ examples/koa/lib/session.ts(2,32): error TS2307: Cannot find module 'iron-session' or its correspondin…
│ examples/lagon/lib/session.ts(1,48): error TS2307: Cannot find module 'iron-session' or its correspond…
│ src/index.test.ts(4,41): error TS2307: Cannot find module 'iron-session' or its corresponding type dec…
│ ELIFECYCLE Command failed with exit code 2.
└─ Failed in 1.3s at /iron-session
ELIFECYCLE Command failed with exit code 1. From the recent repo changes you have done, are the examples folder somehow now attempting to build before the root Iron Session library folder is built? |
I'm not familiar with the desired behavior of your recent ci changes are, however, changing back the "scripts": {
- "build": "tsc --noEmit && tsup",
+ "build": "pnpm i && tsup && cp dist/index.d.ts dist/index.node.d.cts",
"bun:dev": "pnpm --filter=bun-example dev",
"bun:start": "pnpm --filter=bun-example start",
"deno:dev": "pnpm --filter=deno-example dev",
"deno:start": "pnpm --filter=deno-example start",
"koa:dev": "pnpm --filter=koa-example dev",
"koa:start": "pnpm --filter=koa-example start",
"lagon:dev": "pnpm --filter=lagon-example dev",
"lint": "tsc --noEmit && tsc --noEmit -p examples/next/tsconfig.json && tsc --noEmit -p examples/bun/tsconfig.json && pnpm eslint . && deno lint examples/deno && publint",
- "prepare": "pnpm build",
"release": "pnpm lint",
"test": "c8 -r text -r lcov node --loader tsx --test src/*.test.ts && pnpm build",
"test:watch": "node --loader tsx --test --watch src/*.test.ts"
}, |
@renchris I'll fix that indeed, thanks for the heads-up |
Updated @renchris give it another try |
Great, it builds successfully again |
Highlights
.save()
and.destroy()
Cookie OptionsFeature Overview
getServerActionIronSession
's.save()
and.destroy()
functions properly take incookieOptions
and reflect the changes toSet-Cookie
serialize()
the cookie name, seal (the encrypted value), and optionsextractCookieComponents
andsetServerActionCookie
helper functions that destructured the serialized values.set()
the cookie name, seal, and options directly in the.save()
and.destroy()
functionsRemove
encode()
as aCookieOptions
attributeencode
. We now omitencode()
from ourcookieOptions
type. See Mozilla Cookie Attributes and Chrome Cookie AttributesAdd options to the CookieHandler
set
type definition with NextJScookies()
's options typeResponseCookie
More documentation added for Iron Session Options: type definitions, types of Iron Session options, and usage example
Allow for
cookies()
to reflect thepriority
attribute to Set-Cookies by contributing tonext/edge-runtime
with fix: cookies() .set() reflect priority attribute into set-cookie vercel/edge-runtime#640examples/next
's dependencynext
to13.5.5
Move the NextJS Example's dependencies from
examples/next/pnpm-lock.yaml
to the root folder'spnpm-lock.yaml
fileKey References
set
type definitiongetServerActionIronSession
's.save()
functiongetServerActionIronSession
's.destroy()
functionRecognition
Thank you and credit to @devjmetivier for noticing
setServerActionCookie
not passing in cookie options with his #586 (comment) and renchris#1 PR