@netlify/agent-runner-cli 1.90.2 → 1.90.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,7 +49,9 @@ form.addEventListener('submit', async (e) => {
49
49
  })
50
50
  ```
51
51
 
52
- > **SSR apps (Next.js, TanStack Start, SvelteKit, Remix, Nuxt):** POST to `/__forms.html` instead of `/`. SSR frameworks intercept POSTs to `/`, silently preventing Netlify from processing the submission. See [JavaScript Frameworks](#javascript-frameworks-ssr--client-rendered-apps) below.
52
+ > **SSR/SPA apps (React, Vue, TanStack Start, Next.js, SvelteKit, Remix, Nuxt):** You MUST create a static HTML skeleton
53
+ > file for build-time form detection. Without it, Netlify cannot detect the form during build and submissions will
54
+ > silently fail. See [JavaScript Frameworks](#javascript-frameworks-ssr--client-rendered-apps) below.
53
55
 
54
56
  **Critical AJAX requirements:**
55
57
 
@@ -58,34 +60,43 @@ form.addEventListener('submit', async (e) => {
58
60
  ```html
59
61
  <input type="hidden" name="form-name" value="contact" />
60
62
  ```
61
- 3. For SSR/SPA apps, POST to `/__forms.html` instead of `/` (see JavaScript Frameworks section)
62
63
 
63
64
  ## JavaScript Frameworks (SSR & Client-Rendered Apps)
64
65
 
65
- Netlify's build bot cannot detect forms rendered client-side. For any SSR or SPA framework (React, Vue, TanStack Start, Next.js, SvelteKit, Remix, Nuxt), you MUST:
66
+ Netlify's build bot cannot detect forms rendered client-side. For any SSR or SPA framework (React, Vue, TanStack Start,
67
+ Next.js, SvelteKit, Remix, Nuxt), you MUST:
66
68
 
67
- 1. Create `public/__forms.html` containing a static HTML skeleton of each form for build-time detection
68
- 2. Submit via AJAX with `e.preventDefault()` full-page POST will not work
69
- 3. POST to `/__forms.html` (not `/`) — SSR frameworks intercept POSTs to `/`, silently preventing Netlify from processing submissions
69
+ 1. **Create a static HTML skeleton** in `public/` for build-time form detection — this is the critical step. Without it,
70
+ Netlify never registers the form and submissions will silently fail or 404.
71
+ 2. Submit via AJAX with `e.preventDefault()`full-page POST will not work in SPAs
72
+ 3. Include a hidden `form-name` field matching the form's `name` attribute
70
73
 
71
74
  ### Static Form Skeleton
72
75
 
73
- Create `public/__forms.html`:
76
+ Create a static HTML file (e.g. `public/__forms.html`) containing every form your app uses. The file name does not
77
+ matter — Netlify scans all HTML files in the build output:
74
78
 
75
79
  ```html
76
80
  <!-- public/__forms.html — only for Netlify's build bot detection -->
77
81
  <html>
78
82
  <body>
79
- <form name="contact" data-netlify="true" hidden>
83
+ <form name="contact" data-netlify="true" netlify-honeypot="bot-field" hidden>
80
84
  <input type="hidden" name="form-name" value="contact" />
81
85
  <input name="name" />
82
86
  <input name="email" />
83
87
  <textarea name="message"></textarea>
88
+ <input name="bot-field" />
84
89
  </form>
85
90
  </body>
86
91
  </html>
87
92
  ```
88
93
 
94
+ **Rules:**
95
+
96
+ - The form `name` attribute must exactly match the `form-name` value in your React/Vue component
97
+ - Include every field your component submits — Netlify validates field names against the registered form
98
+ - Add `netlify-honeypot="bot-field"` and a `bot-field` input for spam protection
99
+
89
100
  ### React Example
90
101
 
91
102
  ```jsx
@@ -94,7 +105,7 @@ function ContactForm() {
94
105
  e.preventDefault()
95
106
  const formData = new FormData(e.target)
96
107
 
97
- await fetch('/__forms.html', {
108
+ await fetch('/', {
98
109
  method: 'POST',
99
110
  headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
100
111
  body: new URLSearchParams(formData).toString(),
@@ -102,9 +113,14 @@ function ContactForm() {
102
113
  }
103
114
 
104
115
  return (
105
- <form name="contact" method="POST" onSubmit={handleSubmit}>
116
+ <form name="contact" method="POST" data-netlify="true" netlify-honeypot="bot-field" onSubmit={handleSubmit}>
106
117
  {/* Hidden field required for AJAX */}
107
118
  <input type="hidden" name="form-name" value="contact" />
119
+ <p style={{ display: 'none' }}>
120
+ <label>
121
+ Don't fill this out: <input name="bot-field" />
122
+ </label>
123
+ </p>
108
124
  <input name="name" required />
109
125
  <input name="email" type="email" required />
110
126
  <textarea name="message" />
@@ -203,7 +219,8 @@ The `action` path must:
203
219
  - Be relative to site root
204
220
  - Point to an existing page
205
221
 
206
- > **Pretty URLs:** Netlify serves `thank-you.html` at `/thank-you` by default. Use `action="/thank-you"`, not `action="/thank-you.html"` — the `.html` path returns 404.
222
+ > **Pretty URLs:** Netlify serves `thank-you.html` at `/thank-you` by default. Use `action="/thank-you"`, not
223
+ > `action="/thank-you.html"` — the `.html` path returns 404.
207
224
 
208
225
  ## Notifications
209
226
 
@@ -293,17 +310,13 @@ export default async (req: Request, context: Context) => {
293
310
 
294
311
  ### Form succeeds but no submissions appear (SSR apps)
295
312
 
296
- **Cause:** POST to `/` is intercepted by the SSR handler (Next.js, TanStack Start, SvelteKit, Remix, Nuxt). The SSR handler returns 200, so `fetch()` reports success, but Netlify never processes the submission.
313
+ **Cause:** The form was not detected during build. Without a static HTML skeleton, Netlify doesn't register the form, so
314
+ submissions are passed through to the SSR handler (Next.js, TanStack Start, SvelteKit, Remix, Nuxt). The SSR handler
315
+ returns 200, so `fetch()` reports success, but Netlify never processes the submission.
297
316
 
298
- **Fix:** POST to `/__forms.html` instead of `/`:
299
-
300
- ```javascript
301
- await fetch('/__forms.html', {
302
- method: 'POST',
303
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
304
- body: new URLSearchParams(formData).toString(),
305
- })
306
- ```
317
+ **Fix:** Create a static HTML skeleton in `public/` (see
318
+ [JavaScript Frameworks](#javascript-frameworks-ssr--client-rendered-apps) section). Once the form is properly registered
319
+ at build time, Netlify intercepts form POSTs at the CDN level before they reach the SSR handler.
307
320
 
308
321
  ### File upload fails
309
322
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@netlify/agent-runner-cli",
3
3
  "type": "module",
4
- "version": "1.90.2",
4
+ "version": "1.90.4",
5
5
  "description": "CLI tool for running Netlify agents",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",