You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Visiting an API route under the app directory in Next.js 14 while running the dev server with Turbopack
What actually happened?
Any attempts to generate the PDF result in an "invalid distance too far back" error
What did you expect to happen?
The PDF should be generated successfully
How can we reproduce the issue?
Install pdf-lib, Next.js 14, run the Turbopack dev server with next dev --turbo
Version
1.17.1
What environment are you running pdf-lib in?
Node
Checklist
My report includes a Short, Self Contained, Correct (Compilable) Example.
I have attached all PDFs, images, and other files needed to run my SSCCE.
Additional Notes
While I do not have a SSCCE, I have eventually tracked this error down to the pako library with is apparently a port of zlib. pdf-lib and its dependencies are relying on an older v1 version.
By manually overriding pako to v2 (using pnpm in my case) in package.json:
"pnpm": {
"overrides": {
"pako": "^2.1.0"
}
}
For my specific implementation, I no longer run into any issues with the PDF generation and it works as expected.
As an alternative, the normal Webpack dev server can still be used with no problems.
The text was updated successfully, but these errors were encountered:
What were you trying to do?
Trying to generate a PDF
How did you attempt to do it?
Visiting an API route under the app directory in Next.js 14 while running the dev server with Turbopack
What actually happened?
Any attempts to generate the PDF result in an "invalid distance too far back" error
What did you expect to happen?
The PDF should be generated successfully
How can we reproduce the issue?
Install pdf-lib, Next.js 14, run the Turbopack dev server with
next dev --turbo
Version
1.17.1
What environment are you running pdf-lib in?
Node
Checklist
Additional Notes
While I do not have a SSCCE, I have eventually tracked this error down to the
pako
library with is apparently a port ofzlib
.pdf-lib
and its dependencies are relying on an older v1 version.By manually overriding
pako
to v2 (using pnpm in my case) inpackage.json
:For my specific implementation, I no longer run into any issues with the PDF generation and it works as expected.
As an alternative, the normal Webpack dev server can still be used with no problems.
The text was updated successfully, but these errors were encountered: