Skip to content

Is Clerk middleware setup usable with NextJS nodejs runtime? #2721

Discussion options

You must be logged in to vote

I can confirm that changing my imports for authMiddleware, auth, and currentUser from @clerk/nextjs to @clerk/nextjs/server has resolved the issue. Note that any of the components, like UserButton, still had to import from @clerk/nextjs.

However, after seeing this, I've tried only updating the import for authMiddleware. This works too! I compared the output sizes, and keeping @clerk/nextjs/server whenever possible does indeed reduce size a bit, but only when @clerk/nextjs is not imported at all in that file.

Replies: 5 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@verdverm
Comment options

@panteliselef
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by verdverm
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants
Converted from issue

This discussion was converted from issue #2719 on February 05, 2024 09:25.