cloudflare / pages-plugins

MIT License
57 stars 20 forks source link

Static Forms and Mailchannels Plugin hidden input missing causes 405 error #43

Closed wadclapp closed 8 months ago

wadclapp commented 8 months ago

I have a static website (using Nuxt generate static & ssr), and trying to send email from a form, however on submit I got a 405 error page and no email sent, explained below with code...

contact.vue

<form data-static-form-name="sales">
    <label>Email address <input type="email" name="email" /></label>
    <label>Message <textarea name="message"></textarea></label>

    <!-- If the `<form>` has any custom child component, the hidden input (below) is not included -->
    <base-icon icon="my-icon" />

    <button type="Submit">submit</button>

    <!-- Including it manually fixes the problem -->
    <input type="hidden" name="static-form-name" value="sales">
  </form>
GregBrimble commented 8 months ago

I suspect you aren't mounting the Plugin correctly. Can you confirm how you've mounted the Plugin by commenting your relevant file for your folder of functions/?