Uh oh!
There was an error while loading. Please reload this page.
chore(nuxt): Expose event.context.auth() as function - #5513
Conversation
🦋 Changeset detectedLatest commit: ffb0210 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
8e80255 to
580016dCompare580016d to
42f68bcCompare13fbb72 to
a5a0837Comparea5a0837 to
04d793cCompareLauraBeatris
commented
Apr 2, 2025
!snapshot |
clerk-cookie
commented
Apr 2, 2025
Hey @LauraBeatris - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/agent-toolkit@0.0.17-snapshot.v20250402165855 --save-exact
npm i @clerk/astro@2.4.6-snapshot.v20250402165855 --save-exact
npm i @clerk/backend@1.26.0-snapshot.v20250402165855 --save-exact
npm i @clerk/chrome-extension@2.2.24-snapshot.v20250402165855 --save-exact
npm i @clerk/clerk-js@5.59.0-snapshot.v20250402165855 --save-exact
npm i @clerk/elements@0.23.9-snapshot.v20250402165855 --save-exact
npm i @clerk/clerk-expo@2.9.7-snapshot.v20250402165855 --save-exact
npm i @clerk/expo-passkeys@0.2.1-snapshot.v20250402165855 --save-exact
npm i @clerk/express@1.3.60-snapshot.v20250402165855 --save-exact
npm i @clerk/fastify@2.1.33-snapshot.v20250402165855 --save-exact
npm i @clerk/localizations@3.13.5-snapshot.v20250402165855 --save-exact
npm i @clerk/nextjs@6.12.13-snapshot.v20250402165855 --save-exact
npm i @clerk/nuxt@1.5.0-snapshot.v20250402165855 --save-exact
npm i @clerk/clerk-react@5.25.6-snapshot.v20250402165855 --save-exact
npm i @clerk/react-router@1.1.12-snapshot.v20250402165855 --save-exact
npm i @clerk/remix@4.5.12-snapshot.v20250402165855 --save-exact
npm i @clerk/shared@3.3.0-snapshot.v20250402165855 --save-exact
npm i @clerk/tanstack-react-start@0.12.3-snapshot.v20250402165855 --save-exact
npm i @clerk/testing@1.4.34-snapshot.v20250402165855 --save-exact
npm i @clerk/themes@2.2.27-snapshot.v20250402165855 --save-exact
npm i @clerk/types@4.50.2-snapshot.v20250402165855 --save-exact
npm i @clerk/vue@1.4.6-snapshot.v20250402165855 --save-exact |
LauraBeatris
commented
Apr 2, 2025
!snapshot |
clerk-cookie
commented
Apr 2, 2025
Hey @LauraBeatris - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/agent-toolkit@0.0.17-snapshot.v20250402171054 --save-exact
npm i @clerk/astro@2.4.6-snapshot.v20250402171054 --save-exact
npm i @clerk/backend@1.26.0-snapshot.v20250402171054 --save-exact
npm i @clerk/chrome-extension@2.2.24-snapshot.v20250402171054 --save-exact
npm i @clerk/clerk-js@5.59.0-snapshot.v20250402171054 --save-exact
npm i @clerk/elements@0.23.9-snapshot.v20250402171054 --save-exact
npm i @clerk/clerk-expo@2.9.7-snapshot.v20250402171054 --save-exact
npm i @clerk/expo-passkeys@0.2.1-snapshot.v20250402171054 --save-exact
npm i @clerk/express@1.3.60-snapshot.v20250402171054 --save-exact
npm i @clerk/fastify@2.1.33-snapshot.v20250402171054 --save-exact
npm i @clerk/localizations@3.13.5-snapshot.v20250402171054 --save-exact
npm i @clerk/nextjs@6.12.13-snapshot.v20250402171054 --save-exact
npm i @clerk/nuxt@1.5.0-snapshot.v20250402171054 --save-exact
npm i @clerk/clerk-react@5.25.6-snapshot.v20250402171054 --save-exact
npm i @clerk/react-router@1.1.12-snapshot.v20250402171054 --save-exact
npm i @clerk/remix@4.5.12-snapshot.v20250402171054 --save-exact
npm i @clerk/shared@3.3.0-snapshot.v20250402171054 --save-exact
npm i @clerk/tanstack-react-start@0.12.3-snapshot.v20250402171054 --save-exact
npm i @clerk/testing@1.4.34-snapshot.v20250402171054 --save-exact
npm i @clerk/themes@2.2.27-snapshot.v20250402171054 --save-exact
npm i @clerk/types@4.50.2-snapshot.v20250402171054 --save-exact
npm i @clerk/vue@1.4.6-snapshot.v20250402171054 --save-exact |
LauraBeatris
commented
Apr 2, 2025
!snapshot |
clerk-cookie
commented
Apr 2, 2025
Hey @LauraBeatris - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/agent-toolkit@0.0.17-snapshot.v20250402174132 --save-exact
npm i @clerk/astro@2.4.6-snapshot.v20250402174132 --save-exact
npm i @clerk/backend@1.26.0-snapshot.v20250402174132 --save-exact
npm i @clerk/chrome-extension@2.2.24-snapshot.v20250402174132 --save-exact
npm i @clerk/clerk-js@5.59.0-snapshot.v20250402174132 --save-exact
npm i @clerk/elements@0.23.9-snapshot.v20250402174132 --save-exact
npm i @clerk/clerk-expo@2.9.7-snapshot.v20250402174132 --save-exact
npm i @clerk/expo-passkeys@0.2.1-snapshot.v20250402174132 --save-exact
npm i @clerk/express@1.3.60-snapshot.v20250402174132 --save-exact
npm i @clerk/fastify@2.1.33-snapshot.v20250402174132 --save-exact
npm i @clerk/localizations@3.13.5-snapshot.v20250402174132 --save-exact
npm i @clerk/nextjs@6.12.13-snapshot.v20250402174132 --save-exact
npm i @clerk/nuxt@1.5.0-snapshot.v20250402174132 --save-exact
npm i @clerk/clerk-react@5.25.6-snapshot.v20250402174132 --save-exact
npm i @clerk/react-router@1.1.12-snapshot.v20250402174132 --save-exact
npm i @clerk/remix@4.5.12-snapshot.v20250402174132 --save-exact
npm i @clerk/shared@3.3.0-snapshot.v20250402174132 --save-exact
npm i @clerk/tanstack-react-start@0.12.3-snapshot.v20250402174132 --save-exact
npm i @clerk/testing@1.4.34-snapshot.v20250402174132 --save-exact
npm i @clerk/themes@2.2.27-snapshot.v20250402174132 --save-exact
npm i @clerk/types@4.50.2-snapshot.v20250402174132 --save-exact
npm i @clerk/vue@1.4.6-snapshot.v20250402174132 --save-exact |
54fc6b1 to
c20a798Comparec20a798 to
4a3cb7dCompare4a3cb7d to
d19689aCompared19689a to
8c5ebccCompare| const authObject = requestState.toAuth(); | ||
| event.context.auth = authObject; | ||
| const authHandler = () => authObject; |
There was a problem hiding this comment.
I'm planning to raise another PR after shipping this one, which it'll introduce some parameters to this authHandler
That's the whole reason we're doing this change as well, so having a function allow to perform custom logic against the auth object
There was a problem hiding this comment.
Can we add the same code example we have in the description here?
Description
Resolves ORGS-622
Deprecate
event.context.authin favor ofevent.context.auth():export default clerkMiddleware((event) => { + const { userId } = event.context.auth()- const { userId } = event.context.auth const isAdminRoute = event.path.startsWith('/api/admin') if (!userId && isAdminRoute) { throw createError({ statusCode: 401, statusMessage: 'Unauthorized: User not signed in', }) } })This change is needed for an upcoming feature in which options are passed to auth:
auth({ treatPendingAsSignedOn })Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change