-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
I can't use renderToBuffer, renderToStream, etc ... in server side with NextJS 13+ with App router #2460
Comments
Try using the pages router instead. This worked for me. |
No solutions for app router yet? My whole application is based on the App router. |
Unfortunetly, you can you @joshuajaco/react-pdf-renderer-bundled, but if you using packages like @david.kucsai/react-pdf-table you would have a problem, that it doesn't work with App Router. On Client component yeah, but in server component when you tried to use renderToBuffer - unfortunetly - not( |
I think you should resolve using |
You can create pages/api - route even in App Router and it works |
Duplicate of #2350 |
Fixes diegomura#2350 Fixes diegomura#2460 This proposal bundles React with @react-pdf/renderer. The reason for that is Next.js replacing current React version with `18.3.0-canary-8c8ee9ee6-20231026`, which is not compatible with any stable version of react-reconciler available at the moment. I realize that this is a huge change and I'm actually not convinced it's the right way to go, but if anyone would e.g. like to make a custom build on their own, this PR makes it possible to use @react-pdf/renderer in Next.js route handlers seamlessly.
Fixes diegomura#2350 Fixes diegomura#2460 This proposal bundles React with @react-pdf/renderer. The reason for that is Next.js replacing current React version with `18.3.0-canary-8c8ee9ee6-20231026`, which is not compatible with any stable version of react-reconciler available at the moment. I realize that this is a huge change and I'm actually not convinced it's the right way to go, but if anyone would e.g. like to make a custom build on their own, this PR makes it possible to use @react-pdf/renderer in Next.js route handlers seamlessly.
That's fine if you want to create a server side endpoint for use at runtime, but remember that just because someone is using the https://nextjs.org/docs/pages/building-your-application/deploying/static-exports |
Closing it as duplicated |
Describe the bug
In Next.js 13+ using App router , I'm unable to render PDF in Stream or Buffer in Next API routes
Error Message
'ba.Component is not a constructor'
To Reproduce
Steps to reproduce the behavior including code snippet (if applies):
Expected behavior
App should run, react-pdf should render pdfs.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: