"ReferenceError: __dirname is not defined" on Sveltekit app

What is the name of the domain?

cloud-pdf-generator.pages.dev

What is the error message?

“ReferenceError: __dirname is not defined”

What is the issue you’re encountering

I made an app that generates a pdf document by adding an image to the pdf file, but each time I click on generate pdf I get this error.

What steps have you taken to resolve the issue?

I deployed the same app on Vercel and everything works smoothly. I don’t know what could be the problem here. I’d love to remain here on Cloudflare, but this issue is frustrating me and delaying my launch. Any possible fix?

What are the steps to reproduce the issue?

Write anything in the input box and click on generate button

Screenshot of the error

Hi there,

Currently, workers have no access to directories or files.

Take care.

This topic was automatically closed after 15 days. New replies are no longer allowed.