Skip to content
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

feat(nextjs): [improved] Hint correct middleware location when missing clerkMiddleware #5028

Merged
merged 9 commits into from
Jan 29, 2025

Conversation

panteliselef
Copy link
Member

@panteliselef panteliselef commented Jan 28, 2025

Description

This PR brings back the improvements instoduced in #4979 , but it also fixes warnings caused from codesplitting issues when importing clerkMiddelware from /server but /server exports other utilities that use node apis.

Since this reverts a reverted commit, the actual issue is resolved by this new commit

Running next build will not longer complain about usage of process.cwd

Fixes ACTLS-63

next start with defaut rendering (node) next start with edge rendering
missing middelware on node rendering start missing middleware on edge rendering

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Copy link

vercel bot commented Jan 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 28, 2025 7:23pm

Copy link

changeset-bot bot commented Jan 28, 2025

🦋 Changeset detected

Latest commit: a244047

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clerk/nextjs Patch

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

@panteliselef panteliselef requested a review from a team January 28, 2025 14:58
@panteliselef
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @panteliselef - the snapshot version command generated the following package versions:

Package Version
@clerk/astro 2.1.17-snapshot.v20250128145930
@clerk/backend 1.23.9-snapshot.v20250128145930
@clerk/chrome-extension 2.2.3-snapshot.v20250128145930
@clerk/clerk-js 5.50.1-snapshot.v20250128145930
@clerk/elements 0.22.17-snapshot.v20250128145930
@clerk/clerk-expo 2.7.1-snapshot.v20250128145930
@clerk/expo-passkeys 0.1.16-snapshot.v20250128145930
@clerk/express 1.3.44-snapshot.v20250128145930
@clerk/fastify 2.1.17-snapshot.v20250128145930
@clerk/localizations 3.10.2-snapshot.v20250128145930
@clerk/nextjs 6.10.4-snapshot.v20250128145930
@clerk/nuxt 1.0.13-snapshot.v20250128145930
@clerk/clerk-react 5.22.8-snapshot.v20250128145930
@clerk/react-router 1.0.3-snapshot.v20250128145930
@clerk/remix 4.4.19-snapshot.v20250128145930
@clerk/shared 2.20.16-snapshot.v20250128145930
@clerk/tanstack-start 0.8.18-snapshot.v20250128145930
@clerk/testing 1.4.17-snapshot.v20250128145930
@clerk/themes 2.2.14-snapshot.v20250128145930
@clerk/types 4.44.2-snapshot.v20250128145930
@clerk/ui 0.3.18-snapshot.v20250128145930
@clerk/vue 1.1.8-snapshot.v20250128145930

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/astro

npm i @clerk/[email protected] --save-exact

@clerk/backend

npm i @clerk/[email protected] --save-exact

@clerk/chrome-extension

npm i @clerk/[email protected] --save-exact

@clerk/clerk-js

npm i @clerk/[email protected] --save-exact

@clerk/elements

npm i @clerk/[email protected] --save-exact

@clerk/clerk-expo

npm i @clerk/[email protected] --save-exact

@clerk/expo-passkeys

npm i @clerk/[email protected] --save-exact

@clerk/express

npm i @clerk/[email protected] --save-exact

@clerk/fastify

npm i @clerk/[email protected] --save-exact

@clerk/localizations

npm i @clerk/[email protected] --save-exact

@clerk/nextjs

npm i @clerk/[email protected] --save-exact

@clerk/nuxt

npm i @clerk/[email protected] --save-exact

@clerk/clerk-react

npm i @clerk/[email protected] --save-exact

@clerk/react-router

npm i @clerk/[email protected] --save-exact

@clerk/remix

npm i @clerk/[email protected] --save-exact

@clerk/shared

npm i @clerk/[email protected] --save-exact

@clerk/tanstack-start

npm i @clerk/[email protected] --save-exact

@clerk/testing

npm i @clerk/[email protected] --save-exact

@clerk/themes

npm i @clerk/[email protected] --save-exact

@clerk/types

npm i @clerk/[email protected] --save-exact

@clerk/ui

npm i @clerk/[email protected] --save-exact

@clerk/vue

npm i @clerk/[email protected] --save-exact

packages/nextjs/src/server/keyless-node.ts Outdated Show resolved Hide resolved
packages/nextjs/src/server/keyless-node.ts Outdated Show resolved Hide resolved
packages/nextjs/src/server/keyless-node.ts Outdated Show resolved Hide resolved
packages/nextjs/src/server/keyless-node.ts Outdated Show resolved Hide resolved
import type { RequestLike } from './types';
import { assertAuthStatus } from './utils';

export const createGetAuth = ({
export const createAsyncGetAuth = ({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comment here to clarify why we have the split

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@brkalow brkalow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Let's also add a test for this behavior, can be a follow up

@panteliselef panteliselef merged commit ad356bf into main Jan 29, 2025
29 checks passed
@panteliselef panteliselef deleted the elef/fix-hint-middleware branch January 29, 2025 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants