mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-13 22:32:04 +00:00
fix(documents): run pdfjs + canvas un-bundled so scanned PDFs actually rasterize
The bundled (Turbopack) copy of pdfjs-dist failed its render path in the standalone image with a bare Error, so a scanned PDF on a non-Anthropic provider fell back to 'PDF scanning needs a Claude vision provider' — while the identical un-bundled module rasterizes the same document fine (verified in the container end to end on the real document). Externalize pdfjs-dist and @napi-rs/canvas so the server loads the real modules, and hoist pdfjs-dist to the top level in the image so the runtime import resolves. Also log the render error message (not just its name) and drop the redundant 'not saved' note from the document summary panel.
This commit is contained in:
1 parent
8246d9251c
commit
a89e511359
16 files changed
+47
-22
No files matched your search
@@ -176,7 +176,13 @@ export async function rasterizePdf(buffer: Buffer): Promise<RasterResult> {
|
||||
} catch (err) {
|
||||
annotate({
|
||||
action: { name: "documents.rasterize.failed" },
|
||||
meta: { reason: err instanceof Error ? err.name : "unknown" },
|
||||
meta: {
|
||||
reason: err instanceof Error ? err.name : "unknown",
|
||||
// The message pins WHY a render failed (bundled-module mismatch, an
|
||||
// encrypted/odd PDF, a font issue) — the name alone is opaque. Bounded
|
||||
// so a pathological message can't bloat the wide event.
|
||||
message: err instanceof Error ? err.message.slice(0, 300) : String(err),
|
||||
},
|
||||
});
|
||||
return { ok: false };
|
||||
} finally {
|
||||
|
||||
Reference in new issue
Block a user