Netlify Forms and Google's amp-form

Has anyone had successfully implemented Netlify Forms using google’s amp-form element?

I’m having trouble with migrating Netlify forms on the site to amp HTML. More specific, is it possible to have Netlify forms return a JSON object instead of redirect?

Hey there, @doodanroo :wave:

I see this thread has been a bit quiet since you posted it! Are you still trouble with this? Have you started by reading our Forms Docs and Forms Debugging Support Guide?

If you have already read those and are still encountering issues, please share the following information if you are able to:

  1. The URL for your live form as you want visitors to use it
  2. The URL of your deployed html form. In case you have a javascript form, we need to literally be linked to the html version you’ve deployed, as mentioned above (look for “ pure javascript form ”)
  3. The form name that you’ve set and that shows in our UI
  4. Any errors or logs from the Netlify build logs, dashboard or browser developer console
  5. Description of anything you have tried that did or didn’t help or make things better/worse


I came across the same problem. amp-form expects a JSON response and errors on redirect. See the browser log below.

amp.js:130 Powered by AMP ⚡ HTML – Version 2104170104001
log.js:254 [amp-form] Failed to parse response JSON: SyntaxError: Unexpected token < in JSON at position 0
ub @ log.js:254
g.Ta @ log.js:309
g.error @ log.js:326
(anonymous) @ amp-form.js:1002
Promise.then (async)
Pc @ amp-form.js:996
(anonymous) @ amp-form.js:752
Promise.then (async)
Jc @ amp-form.js:751
(anonymous) @ amp-form.js:714
Promise.then (async)
(anonymous) @ amp-form.js:673
Promise.then (async)
xc @ amp-form.js:668
(anonymous) @ amp-form.js:528
Promise.then (async)
push.f.m.Ha @ amp-form.js:380
cg @ action-impl.js:733
g.execute @ action-impl.js:449
Uh @ document-submit.js:161

Also, it does not allow action form attribute as it’s using action-xhr instead.

The form submission seems to work but there’s no way to notify the user. I’m using Next.js + AMP.

Hi @alyx ! I don’t recommend using amp-form element on Netlify sites atm it you won’t be able to receive submissions.

1 Like