Astro + Resend works locally, in production Error: Missing API key

PLEASE help us help you by writing a good post!

  • We need to know your netlify site name. Example: gifted-antelope-58b104.netlify.app
  • DNS issues? Tell us the custom domain, tell us the error message! We can’t help if we don’t know your domain.
  • Build problems? Link or paste the FULL build log & build settings screenshot
  • Did you try Ask Netlify, our generative AI chatbot, before posting? It pulls info from Support Guides and recent solved forums posts.

The better the post - the faster the answer.

I have created a Astro site and for sending emails I use Resend (https://fwllv.netlify.app).
I followed this specific guide.
Send emails with Astro - Resend

Everything work locally, but when I deploy to Netlify, I get this error:
Feb 24, 12:55:12 AM: 2d4da422 ERROR 22:55:12 [ERROR] [router] Error while trying to render the route /_actions/[…path]Feb 24, 12:55:12 AM: 2d4da422 ERROR 22:55:12 [ERROR] Error: Missing API key. Pass it to the constructor new Resend("re_123")

  • at new Resend (file:///var/task/node_modules/resend/dist/index.mjs:903:25)*
  • at file:///var/task/.netlify/build/entrypoint.mjs:7:16*
  • at ModuleJob.run (node:internal/modules/esm/module_job:343:25)*
  • at async onImport.tracePromise.proto (node:internal/modules/esm/loader:665:26)*
  • at async AppPipeline.getActions (file:///var/task/node_modules/astro/dist/core/base-pipeline.js:67:14)*
  • at async RenderContext.create (file:///var/task/node_modules/astro/dist/core/render-context.js:91:40)*
  • at async App.render (file:///var/task/node_modules/astro/dist/core/app/index.js:382:29)*
  • at async handler (file:///var/task/node_modules/@astrojs/netlify/dist/ssr-function.js:29:24)*
  • at async sh (file:///var/task/___netlify-bootstrap.mjs:2:152359)*
  • at async Runtime.handler (file:///var/task/___netlify-bootstrap.mjs:2:151695)*

The key is added to the Netlify Enviroment variables.

Maybe somone could give me some suggestions what more I can try out

Can you share a minimal reproduction?