fix: ship the pdfjs worker so PDF CVs can be read in production - #258
Merged
Conversation
Every PDF parse in production was failing. Nitro's dependency tracer never sees pdfjs-dist's worker, because pdfjs builds that import specifier at runtime, so pdf.worker.mjs was dropped from the server bundle and each parse died with: Setting up fake worker failed: "Cannot find module '/app/.output/server/node_modules/pdfjs-dist/legacy/build/pdf.worker.mjs'" Recruiters saw this as CVs that wouldn't autofill and candidates scored 0%, because a failed parse leaves the resume text empty and the model is handed nothing to evaluate. externals.traceInclude cannot express this — Nitro resolves the entry back through Rollup, gets the bare specifier, and passes that to nodeFileTrace as a root-relative path — so the worker is copied into the bundle from a nitro `compiled` hook instead. Two related defects found while confirming the fix: - pdf-parse stamps "-- 1 of 3 --" page markers into extracted text by default. On an image-only CV those markers are the only text, so the document read as non-empty, was stored, and reached the model as the candidate's entire resume — a silent 0% with nothing logged. - parseDocument collapsed "the parser crashed" and "this document has no text" into the same null, which is how a server packaging bug spent months surfacing to users as "this CV is a scan". Callers can now tell the two apart via parseDocumentDetailed, and the extract-cv endpoint returns 503 rather than blaming the recruiter's file. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
🚅 Deployed to the reqcore-pr-258 environment in applirank
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every PDF parse in production was failing. Nitro's dependency tracer never sees pdfjs-dist's worker, because pdfjs builds that import specifier at runtime, so pdf.worker.mjs was dropped from the server bundle and each parse died with:
Setting up fake worker failed: "Cannot find module
'/app/.output/server/node_modules/pdfjs-dist/legacy/build/pdf.worker.mjs'"
Recruiters saw this as CVs that wouldn't autofill and candidates scored 0%, because a failed parse leaves the resume text empty and the model is handed nothing to evaluate.
externals.traceInclude cannot express this — Nitro resolves the entry back through Rollup, gets the bare specifier, and passes that to nodeFileTrace as a root-relative path — so the worker is copied into the bundle from a nitro
compiledhook instead.Two related defects found while confirming the fix:
Summary
Type of change
Validation
DCO
Signed-off-by) viagit commit -s