Files
StageAI/package.json
CTO 79191c3810
All checks were successful
Deploy to VPS / deploy (push) Successful in 1m10s
fix: replace pdf-parse with direct pdfjs-dist to fix DOMMatrix error in production
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>
2026-04-10 21:19:20 +00:00

39 lines
889 B
JSON

{
"name": "legalai",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "eslint"
},
"dependencies": {
"@ai-sdk/anthropic": "^3.0.68",
"@ai-sdk/openai": "^3.0.52",
"@types/bcryptjs": "^2.4.6",
"ai": "^6.0.154",
"bcryptjs": "^3.0.3",
"drizzle-orm": "^0.45.2",
"mammoth": "^1.12.0",
"next": "16.2.3",
"next-auth": "^4.24.13",
"pdfjs-dist": "^5.4.296",
"pg": "^8.20.0",
"react": "19.2.4",
"react-dom": "19.2.4"
},
"devDependencies": {
"@tailwindcss/postcss": "^4.2.2",
"@types/node": "^20",
"@types/pg": "^8.20.0",
"@types/react": "19.2.14",
"@types/react-dom": "^19",
"drizzle-kit": "^0.31.10",
"eslint": "^9",
"eslint-config-next": "16.2.3",
"tailwindcss": "^4.2.2",
"typescript": "5.9.3"
}
}