fix: replace pdf-parse with direct pdfjs-dist to fix DOMMatrix error in production
All checks were successful
Deploy to VPS / deploy (push) Successful in 1m10s
All checks were successful
Deploy to VPS / deploy (push) Successful in 1m10s
pdf-parse v2 depends on @napi-rs/canvas (native module) which fails in Next.js standalone Docker builds — native binaries aren't traced/copied to the standalone output, causing DOMMatrix is not defined at runtime. Replaced pdf-parse entirely with pdfjs-dist legacy build which works natively in Node.js without canvas or DOM API dependencies: - New src/lib/pdf.ts: extractTextFromPdf() using pdfjs-dist/legacy/build - Worker file explicitly imported so Next.js file tracer includes it - Updated all call sites: documents, norms/parse, contracts - Removed pdf-parse from dependencies, added pdfjs-dist directly - Changed serverExternalPackages from pdf-parse to pdfjs-dist Verified: build succeeds, both pdf.mjs and pdf.worker.mjs present in .next/standalone, text extraction works in standalone context. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
"mammoth": "^1.12.0",
|
||||
"next": "16.2.3",
|
||||
"next-auth": "^4.24.13",
|
||||
"pdf-parse": "^2.4.5",
|
||||
"pdfjs-dist": "^5.4.296",
|
||||
"pg": "^8.20.0",
|
||||
"react": "19.2.4",
|
||||
"react-dom": "19.2.4"
|
||||
|
||||
Reference in New Issue
Block a user