why Cookie values “appSession” can’t rename to name with hyphen?
ccmiko opened this issue · comments
ccmiko commented
Checklist
- The issue can be reproduced in the nextjs-auth0 sample app (or N/A).
- I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- I have looked into the API documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
Description
recently, i learned Cookie prefixes.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#cookie_prefixes
so i tried my app's appSession
rename to Host-appSesion
set to .env.local
AUTH0_SESSION_NAME="Host-appSession"
result, I have error.
TypeError: "session.name" must only contain alpha-numeric and underscore characters
https://github.com/auth0/nextjs-auth0/blob/main/src/auth0-session/get-config.ts#L32
perhaps....Cookie prefixes now a deprecated security setting?
Here are use nextjs-auth0 sample app have error
[0] ProfileHandlerError: Profile handler failed. CAUSE: "session.name" must only contain alpha-numeric and underscore characters
[0] at eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/profile.js:53:19)
[0] at eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/router-helpers.js:9:20)
[0] ... 32 lines matching cause stack trace ...
[0] at async DevServer.handleRequestImpl (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/server/base-server.js:722:17) {
[0] code: 'ERR_PROFILE_HANDLER_FAILURE',
[0] cause: TypeError: "session.name" must only contain alpha-numeric and underscore characters
[0] at get (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/auth0-session/get-config.js:184:15)
[0] at getConfig (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/config.js:76:45)
[0] at eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/config.js:148:44)
[0] at eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/profile.js:24:34)
[0] at eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/router-helpers.js:9:20)
[0] at eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/auth.js:60:30)
[0] at eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/auth.js:36:24)
[0] at /Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:1:66883
[0] at /Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/server/lib/trace/tracer.js:117:36
[0] at NoopContextManager.with (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057)
[0] at ContextAPI.with (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516)
[0] at NoopTracer.startActiveSpan (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18086)
[0] at ProxyTracer.startActiveSpan (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18847)
[0] at /Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/server/lib/trace/tracer.js:106:107
[0] at NoopContextManager.with (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057)
[0] at ContextAPI.with (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516)
[0] at NextTracerImpl.trace (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/server/lib/trace/tracer.js:106:32)
[0] at /Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:1:66664
[0] at AsyncLocalStorage.run (node:async_hooks:346:14)
[0] at Object.wrap (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:1:41999)
[0] at /Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:1:64428
[0] at AsyncLocalStorage.run (node:async_hooks:346:14)
[0] at Object.wrap (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:1:41579)
[0] at /Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:1:64389
[0] at AsyncLocalStorage.run (node:async_hooks:346:14)
[0] at Ae.execute (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:1:64362)
[0] at Ae.handle (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:1:68073)
[0] at doRender (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/server/base-server.js:1211:56)
[0] at cacheEntry.responseCache.get.incrementalCache.incrementalCache (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/server/base-server.js:1427:46)
[0] at /Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/server/response-cache/index.js:102:42
[0] at ResponseCache.get (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/server/response-cache/index.js:156:11)
[0] at DevServer.renderToResponseWithComponentsImpl (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/server/base-server.js:1355:53)
[0] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[0] at async DevServer.renderPageComponent (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/server/base-server.js:1591:24)
[0] at async DevServer.renderToResponseImpl (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/server/base-server.js:1629:32)
[0] at async DevServer.pipeImpl (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/server/base-server.js:820:25)
[0] at async DevServer.handleCatchallRenderRequest (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/server/next-server.js:623:13)
[0] at async DevServer.handleRequestImpl (/Users/MyPcUserName/Desktop/sample-01/node_modules/next/dist/server/base-server.js:722:17),
[0] status: undefined
[0] }
Reproduction
how to reproduced in the nextjs-auth0 sample app
- Follow https://auth0.com/docs/quickstart/webapp/nextjs to build a sample app
- add
.env.local
toAUTH0_SESSION_NAME="Host-appSession"
- run app (
npm run dev
) - error output to console
Additional context
No response
nextjs-auth0 version
1.9.2
Next.js version
13.2.0
Node.js version
20.6.1