@netlify/agent-runner-cli 1.89.1 → 1.89.3

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,6 +49,8 @@ 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.
53
+
52
54
  **Critical AJAX requirements:**
53
55
 
54
56
  1. Content-Type MUST be `application/x-www-form-urlencoded`
@@ -56,29 +58,32 @@ form.addEventListener('submit', async (e) => {
56
58
  ```html
57
59
  <input type="hidden" name="form-name" value="contact" />
58
60
  ```
61
+ 3. For SSR/SPA apps, POST to `/__forms.html` instead of `/` (see JavaScript Frameworks section)
59
62
 
60
- ## JavaScript Frameworks (React, Vue, Next.js)
61
-
62
- Netlify's build bot cannot detect forms rendered client-side. You MUST create a static HTML version.
63
+ ## JavaScript Frameworks (SSR & Client-Rendered Apps)
63
64
 
64
- ### Next.js Runtime v5
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:
65
66
 
66
- If using Netlify Forms with Next.js Runtime v5, you **must**:
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
67
70
 
68
- 1. Extract form definitions to a dedicated static HTML file (e.g., `public/__forms.html`)
69
- 2. Submit forms using AJAX — full-page navigation won't work
71
+ ### Static Form Skeleton
70
72
 
71
- ### Solution: Hidden HTML Skeleton
72
-
73
- Create `public/__forms.html` (or include in your static HTML):
73
+ Create `public/__forms.html`:
74
74
 
75
75
  ```html
76
- <!-- This file is only for Netlify's build bot detection -->
77
- <form name="contact" netlify hidden>
78
- <input name="name" />
79
- <input name="email" />
80
- <textarea name="message"></textarea>
81
- </form>
76
+ <!-- public/__forms.html only for Netlify's build bot detection -->
77
+ <html>
78
+ <body>
79
+ <form name="contact" data-netlify="true" hidden>
80
+ <input type="hidden" name="form-name" value="contact" />
81
+ <input name="name" />
82
+ <input name="email" />
83
+ <textarea name="message"></textarea>
84
+ </form>
85
+ </body>
86
+ </html>
82
87
  ```
83
88
 
84
89
  ### React Example
@@ -89,7 +94,7 @@ function ContactForm() {
89
94
  e.preventDefault()
90
95
  const formData = new FormData(e.target)
91
96
 
92
- await fetch('/', {
97
+ await fetch('/__forms.html', {
93
98
  method: 'POST',
94
99
  headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
95
100
  body: new URLSearchParams(formData).toString(),
@@ -198,6 +203,8 @@ The `action` path must:
198
203
  - Be relative to site root
199
204
  - Point to an existing page
200
205
 
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.
207
+
201
208
  ## Notifications
202
209
 
203
210
  ### Email Notifications
@@ -284,6 +291,20 @@ export default async (req: Request, context: Context) => {
284
291
  2. `form-name` field is included in body
285
292
  3. Check browser Network tab for actual response
286
293
 
294
+ ### Form succeeds but no submissions appear (SSR apps)
295
+
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.
297
+
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
+ ```
307
+
287
308
  ### File upload fails
288
309
 
289
310
  **Check:**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@netlify/agent-runner-cli",
3
3
  "type": "module",
4
- "version": "1.89.1",
4
+ "version": "1.89.3",
5
5
  "description": "CLI tool for running Netlify agents",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",