Why Does Cloudflare Pages Hate My PDFs? A Mysterious 500 Error Awaits Your Genius!
Hey everyone,
I’m scratching my head over a stubborn issue with Cloudflare Pages and Nuxt 3’s serverless API. I’m trying to process PDFs using pdfjs-dist, but I keep hitting a 500 error. The import import * as pdfjsLib from 'pdfjs-dist/legacy/build/pdf.js' doesn’t seem to play nice in this serverless environment, and even my workaround isn’t cutting it. Here’s the error I’m getting:
Here’s what I’ve tried so far:
Switched to a dynamic import with a static path:
Dropped the workerSrc config since it’s not needed in this setup.
Still no luck! Has anyone tackled pdfjs-dist in Cloudflare Pages’ serverless world? Is there a secret sauce to making this work, or am I missing something obvious? Any help would be awesome—thanks in advance!
0 Replies