rag(portf)pgvector), Drizzle ORM, pdfjs-dist (Legacy ESM build)src/app/api/ingest/route.ts) that streams incoming multipart form binaries directly into an in-memory execution layer, without writing temporary files to disk.Module not found: Can't resolve './schema.js'."moduleResolution": "bundler" or "nodenext" variations in tsconfig.json), Next.js natively handles route mapping paths inside the framework compiler. Forcing rigid .js or .ts extensions in standard project references caused the module layout engine to look for compiled JavaScript files that did not yet exist in .next/server.route.ts, ingest.ts, and the Drizzle database configuration files, letting the Next.js compiler resolve file nodes directly.pdfjs-dist.Plaintext
TypeError: Invalid `workerSrc` type. Expected string, got object.
at set workerSrc (webpack://pdf.js/src/display/worker_options.js:58:13)
import * as pdfWorker from "pdfjs-dist/build/pdf.worker.mjs") causes Turbopack to interpret the payload as an internal module chunk object instead of a literal, static filesystem string path. This triggers a strict type validation failure inside the PDF.js engine core..mjs worker component inside node_modules, then translated it into a literal file:// string using pathToFileURL:TypeScript
import path from "path";
import { pathToFileURL } from "url";
import * as pdfjs from "pdfjs-dist/legacy/build/pdf.mjs";
const workerPath = path.join(
process.cwd(),
"node_modules",
"pdfjs-dist",
"legacy",
"build",
"pdf.worker.mjs"
);
pdfjs.GlobalWorkerOptions.workerSrc = pathToFileURL(workerPath).toString();