Skip to content

PDF thumbnails do not work in compose deployment #1151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
make-github-pseudonymous-again opened this issue Feb 15, 2025 · 6 comments · Fixed by #1152
Closed

PDF thumbnails do not work in compose deployment #1151

make-github-pseudonymous-again opened this issue Feb 15, 2025 · 6 comments · Fixed by #1152
Labels
bug Something isn't working deploy This issue is about deployment feature/attachments This issue is about the attachments functionality research This needs some research.

Comments

@make-github-pseudonymous-again
Copy link
Contributor

Here are the logs I get:

patient-web-1                         | chunk of file 9GcQnPh6otwongK5a/123.pdf was not found
patient-web-1                         | {
patient-web-1                         |   error: TypeError: Cannot read property 'workerSrc' of undefined
patient-web-1                         |       at imports/lib/pdf/pdf.ts:28:32
patient-web-1                         |       at /home/nonroot/dist/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40
patient-web-1                         |    => awaited here:
patient-web-1                         |       at Function.Promise.await (/home/nonroot/dist/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)
patient-web-1                         |       at imports/lib/pdf/pdfthumbnails.ts:225:21
patient-web-1                         |       at /home/nonroot/dist/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40
patient-web-1                         |    => awaited here:
patient-web-1                         |       at Function.Promise.await (/home/nonroot/dist/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)
patient-web-1                         |       at imports/api/uploads.ts:88:15
patient-web-1                         |       at /home/nonroot/dist/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40
patient-web-1                         | }
patient-web-1                         | chunk of file ZLFjohwfk3RSgbGR3/456.pdf was not found
patient-web-1                         | {
patient-web-1                         |   error: TypeError: Cannot read property 'workerSrc' of undefined
patient-web-1                         |       at imports/lib/pdf/pdf.ts:28:32
patient-web-1                         |       at /home/nonroot/dist/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40
patient-web-1                         |    => awaited here:
patient-web-1                         |       at Function.Promise.await (/home/nonroot/dist/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)
patient-web-1                         |       at imports/lib/pdf/pdfthumbnails.ts:225:21
patient-web-1                         |       at /home/nonroot/dist/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40
patient-web-1                         |    => awaited here:
patient-web-1                         |       at Function.Promise.await (/home/nonroot/dist/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)
patient-web-1                         |       at imports/api/uploads.ts:88:15
patient-web-1                         |       at /home/nonroot/dist/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40
patient-web-1                         | }
@make-github-pseudonymous-again make-github-pseudonymous-again added bug Something isn't working deploy This issue is about deployment feature/attachments This issue is about the attachments functionality labels Feb 15, 2025
@make-github-pseudonymous-again
Copy link
Contributor Author

Just confirmed this works with meteor npm run dev. So likely a problem with the container image.

@make-github-pseudonymous-again make-github-pseudonymous-again added the research This needs some research. label Feb 16, 2025
@make-github-pseudonymous-again
Copy link
Contributor Author

make-github-pseudonymous-again commented Feb 16, 2025

So, apparently, the image contains both dist/programs/server/node_modules and dist/programs/server/npm/node_modules. Only dist/programs/server/npm/node_modules/pdfjs-dist exists. It contains dist/programs/server/npm/node_modules/pdfjs-dist/legacy/build/pdf.js.

This does not appear to be a problem for other packages which use dynamic imports of specific paths (healthone, medidoc, date-fns, @mui/x-date-pickers).

@make-github-pseudonymous-again
Copy link
Contributor Author

make-github-pseudonymous-again commented Feb 16, 2025

Looking at the first such failure we find another error message regarding missing libuuid.so.1, required by canvas:

patient-web-1  | {
patient-web-1  |   error: Error: libuuid.so.1: cannot open shared object file: No such file or directory
patient-web-1  |       at Object.Module._extensions..node (internal/modules/cjs/loader.js:1175:18)
patient-web-1  |       at Module.load (internal/modules/cjs/loader.js:981:32)
patient-web-1  |       at Module.Mp.load (/home/nonroot/dist/programs/server/runtime.js:37:33)
patient-web-1  |       at Function.Module._load (internal/modules/cjs/loader.js:821:12)
patient-web-1  |       at Module.require (internal/modules/cjs/loader.js:1005:19)
patient-web-1  |       at require (internal/modules/cjs/helpers.js:107:18)
patient-web-1  |       at Object.<anonymous> (/home/nonroot/dist/programs/server/npm/node_modules/canvas/lib/bindings.js:3:18)
patient-web-1  |       at Module._compile (internal/modules/cjs/loader.js:1116:14)
patient-web-1  |       at Module.Mp._compile (/home/nonroot/dist/programs/server/runtime.js:77:23)
patient-web-1  |       at Object.Module._extensions..js (internal/modules/cjs/loader.js:1145:10)
patient-web-1  |       at Module.load (internal/modules/cjs/loader.js:981:32)
patient-web-1  |       at Module.Mp.load (/home/nonroot/dist/programs/server/runtime.js:37:33)
patient-web-1  |       at Function.Module._load (internal/modules/cjs/loader.js:821:12)
patient-web-1  |       at Module.require (internal/modules/cjs/loader.js:1005:19)
patient-web-1  |       at require (internal/modules/cjs/helpers.js:107:18)
patient-web-1  |       at Object.<anonymous> (/home/nonroot/dist/programs/server/npm/node_modules/canvas/lib/canvas.js:9:18)
patient-web-1  |    => awaited here:
patient-web-1  |       at Function.Promise.await (/home/nonroot/dist/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_s
erver.js:56:12)
patient-web-1  |       at imports/lib/pdf/pdf.ts:25:31
patient-web-1  |       at /home/nonroot/dist/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40
patient-web-1  |    => awaited here:
patient-web-1  |       at Function.Promise.await (/home/nonroot/dist/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_s
erver.js:56:12)
patient-web-1  |       at imports/lib/pdf/pdfthumbnails.ts:225:21
patient-web-1  |       at /home/nonroot/dist/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40
patient-web-1  |    => awaited here:
patient-web-1  |       at Function.Promise.await (/home/nonroot/dist/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_s
erver.js:56:12)
patient-web-1  |       at imports/api/uploads.ts:88:15
patient-web-1  |       at /home/nonroot/dist/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40 {
patient-web-1  |     code: 'ERR_DLOPEN_FAILED'
patient-web-1  |   }
patient-web-1  | }

[email protected] which we are running requires canvas as a polyfill on Node.js. See:

The error message is a bit laborious to decrypt because canvas fails with ERR_DLOPEN_FAILED, but only on first attempt. Subsequent requires just silently return an empty module object.

@make-github-pseudonymous-again
Copy link
Contributor Author

make-github-pseudonymous-again commented Feb 16, 2025

Since the main image is distroless-based but we build on Debian slim, one option is perhaps to copy the missing library from the build image to the main image.

@make-github-pseudonymous-again make-github-pseudonymous-again changed the title PDF thumbnails do not work in attempted compose deployment PDF thumbnails do not work in compose deployment Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working deploy This issue is about deployment feature/attachments This issue is about the attachments functionality research This needs some research.
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

1 participant