Skip to content

Update Send form submissions using Astro and Resend tutorial #24983

@OliverSpeir

Description

@OliverSpeir

Existing documentation URL(s)

https://developers.cloudflare.com/developer-spotlight/tutorials/handle-form-submission-with-astro-resend/

What changes are you suggesting?

User reported this tutorial was broken in Astro discord.

It contains a couple issues:

  1. It suggests users use export const prerender = false in a component, but this needs to be done at the page level ( in src/pages/route.astro)
  2. It suggests users handle post requests to the route in the component, but this needs also needs to be done at the page level
  3. It mentions that users can make a page not be pre-rendered using a template directive, but this isn't accurate
  4. It suggests users use import.meta.env to access secrets, but this needs to be done either with Astro.locals.runtime.env or using Astro's Typesafe env helper

This guide could be updated to use Astro actions and Astro:env. There is a resend astro guide we can model it after. It could also benefit from using the package manager code block tabs for some of the code blocks as well.

Here is a repo that shows what the tutorial might result in if updated, it could be cut down a lot too of course

Additional information

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions