Problem
https://[domain].pages.dev/account/api?/updateProfile
fails during loading of the assets with the error:
"message": [
"No email body: requires plaintextBody or htmlBody. Template: ",
"welcome_email"
],
LLM Response
It looks like the email is not bundled correctly and this is apparently they are not included in the worker bundle:
You’re using this pattern:
const htmlTemplate = await import(
`./emails/${template_name}_html.hbs?raw`
).then((mod) => mod.default)
This works locally because Vite (or your local bundler) understands ?raw and includes those files. But Cloudflare Pages Functions use their own esbuild-based runtime, and:
❗️**?raw imports are not guaranteed to work on Cloudflare by default.**
What I have tried so far
I'm a bit skeptic how this can be true, asthe live demo also uses cloudflare (at least recommends to do so)
I have tried
assetsInclude: ['**/*.hbs'], // in vite.config.ts
I also tried to specifically import the files and pass them (but invoking the render function there will cause "EvalError: Code generation from strings disallowed for this context"
And I have also tried switching from handlebars to eta with no success.
Additional Information
- I'm using adapter-cloudflare instead of adapter-auto
Problem
https://[domain].pages.dev/account/api?/updateProfile
fails during loading of the assets with the error:
LLM Response
It looks like the email is not bundled correctly and this is apparently they are not included in the worker bundle:
You’re using this pattern:
This works locally because Vite (or your local bundler) understands ?raw and includes those files. But Cloudflare Pages Functions use their own esbuild-based runtime, and:
❗️**?raw imports are not guaranteed to work on Cloudflare by default.**
What I have tried so far
I'm a bit skeptic how this can be true, asthe live demo also uses cloudflare (at least recommends to do so)
I have tried
assetsInclude: ['**/*.hbs'], // in vite.config.tsI also tried to specifically import the files and pass them (but invoking the render function there will cause "EvalError: Code generation from strings disallowed for this context"
And I have also tried switching from handlebars to eta with no success.
Additional Information