Comments (4)
Hi, thanks for the issue!
The Partial Prerendering feature is marked as highly experimental:
Warning: Partial Prerendering is an experimental feature and is currently not suitable for production environments.
It also has these gotchas:
Partial Prerendering does not yet apply to client-side navigations. We are actively working on this.
There's a good chance that things are not working because something isn't implemented/right yet in Next.js itself. It's also possible that we'll need to update something on our end. Until this feature is in beta or soon to be released we'll however not spend time on this as things aren't settled just yet.
I'd encourage you to open an issue on Next.js and see what the root cause of the error might be. Thanks!
from javascript.
Hey @LekoArts,
Thanks for looking into this. While I see, that this feature is still experimental, I don't agree with your statement that this lies on nexts side.
React throws an error when server features are used (headers, cookies) that is used to determine if a component needs to opt out of static rendering (and will be partially prerendered). Since your implementation uses headers() within a try-catch blog:
Prerendering /_not-found needs to partially bail out because something dynamic was used. React throws a special object to indicate where we need to bail out but it was caught by a try/catch or a Promise was not awaited. These special objects should not be caught by your own try/catch. Learn more: https://nextjs.org/docs/messages/ppr-caught-error
⚠ The following error was thrown during build, and may help identify the source of the issue:
⨯ Error: Clerk: auth() and currentUser() are only supported in App Router (/app directory).
If you're using /pages, try getAuth() instead.
Original error: Error: This page needs to bail out of prerendering at this point because it used headers. React throws this special object to indicate where. It should not be caught by your own try/catch. Learn more: https://nextjs.org/docs/messages/ppr-caught-error
I see that this feature is still experimental, but I am certain it will make it to prod. and also certain that the implementation will be similar to what it is right now, since they don't want to introduce new apis for this.
Here is the matching lines of code:
https://github.com/clerk/javascript/blob/main/packages/nextjs/src/app-router/server/utils.ts#L4C1-L21C3
A simple solution would be to determine and integrate the new error message into the rethrow block of buildRequestLike and simply rethrow this error as well.
It is indeed annoying, since I would love to use PPR right now and clerk is the only thing holding me back.
Should be a simple fix. Please reopen. Happy to help :)
from javascript.
Okay, if you think that change alone would make it work, then please put up a PR. As I said we have other priorities right now but happy to look at a PR.
You can (quickly) test this yourself locally:
- Remove your
.next
folder - Go into
node_modules/@clerk/nextjs/dist/esm/server/utils.js
and make your change there - Start the server
from javascript.
hey @LekoArts,
Just created a PR. Tested it and fixes the issue :) #2518
Do you roughly know when I can expect it to work with the npm package?
from javascript.
Related Issues (20)
- Remix.run Clerk SDK server functions not returning permissions, roles, organization info, etc... HOT 6
- V5: `OrganizationProfile` throws error upon logout HOT 15
- The ignore option for @clerk/upgrade is ignored HOT 5
- React Native Support HOT 1
- Deprecated prop `afterSignInUrl` at `ClerkContextProvider` instead of `fallbackRedirectUrl` or `forceRedirectUrl` HOT 2
- Incorrect Return Type for getAllowlistIdentifierList HOT 3
- Cannot remove divider above Privacy and Terms links in core-2 HOT 3
- Unable to Access users Property in Clerk SDK for Node.js v5.0.2 HOT 1
- `@clerk/nextjs` middleware redirection issue on login with email on chrome HOT 16
- [Node SDK]: Failed to resolve JWK during verification HOT 6
- Home Page not auto-redirecting to clerk auth page on localhost in "@clerk/nextjs": "^5.0.3" HOT 2
- `@clerk/upgrade` does not seem to work via yarn HOT 3
- Unable to add custom header when calling "isProtectedRoute". HOT 4
- forceRedirectUrl is not working when using SignInButton HOT 14
- Too many redirects on clerk.com (Dashboard AND docs) HOT 1
- React Native @clerk/clerk-expo is not working as expected HOT 20
- Sign out not working reliably in @clerk/nextjs v5 HOT 2
- [Next App Router] i18n not work on `clerkMiddleware` HOT 6
- I upgraded my app from version Expo SDK 50 to 51 and since then clerk has completely broken HOT 7
- Clerk core v2 - Clerk fails to load under cypress iframe - "Browser unauthenticated" HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javascript.