amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

(Seemingly random) Form submission broken when page is served from AMP Cache

Open weeblr opened this issue 9 years ago • 8 comments

Short description of your issue:

This is on a stock WooCommerce site. The AMP version has Add To Cart working fine on the origin AMP version of the site, and also when the AMP page is served from the AMP cache.

However, after reloading the page a few times and performing add to cart a few times (still from the AMP cache page), the Add To Cart fails with:

Blocked form submission to '' because the form's frame is sandboxed and the 'allow-forms' permission is not set.

appearing in the browser console (latest Chrome).

The failure is immediately solved by

  • closing/re-opening Chrome,
  • reloading the exact same page in an incognito window
  • switching to another browser

Going to Application / Clear storage and clearing local and session storage, cookies, cache, etc does NOT solve the issue.

How do we reproduce the issue?

Here is a sample product page, from the origin server.

Here is the same from the AMP Cache.

Not sure about the steps, again it seems pretty random (though it doesn't go away until Chrome is closed), but I would think:

  • load the AMP cache version, add the product to cart
  • click on Continue shopping: that takes you to an AMP page, but on the origin server, so you have to reload the AMP cache version to try again

Repeat a few times, or navigate to other products, loading the copy in the AMP cache each times, which is the only one that triggers the problem after a while.

Hope you can shed some light here, I don't see any "frame" that would be sandboxed. And the form has an action-xhr that is definitely not empty, and points to the correct endpoint on the origin server.

Thanks and regards

What browsers are affected?

Chrome, untested with others

Which AMP version is affected?

This is new, but then I never tried before!

weeblr avatar Mar 05 '17 17:03 weeblr

/to @aghassemi

jridgewell avatar Mar 10 '17 22:03 jridgewell

@weeblr are you still able to reproduce this on your end? I tried continuously a few times now and I haven't seen the behavior you're describing. I moved from the cached version to the origin version and back many times and the form never failed to submit.

cvializ avatar Apr 10 '17 18:04 cvializ

Hi @cvializ Indeed, I can't reproduce any longer. Thanks for looking, not sure what fixed it, but is seems fixed.

weeblr avatar Apr 11 '17 09:04 weeblr

🎉 That's great news, thanks for the update! If you notice it again feel free to reopen this issue, but for now I will mark it closed

cvializ avatar Apr 11 '17 17:04 cvializ

I am starting to have more traffic on that demo now, so if this pops back up, I'm sure they'll let me know pretty quick! Thanks.

weeblr avatar Apr 11 '17 17:04 weeblr

@cvializ @weeblr This issue just happened to me exactly as you described in the latest desktop Chrome with the following URL when trying to submit the form:

https://www-tollbrothers-com.cdn.ampproject.org/c/s/www.tollbrothers.com/contact/other-inquiries?amp=true

Console message:

Blocked form submission to '' because the form's frame is sandboxed and the 'allow-forms' permission is not set.

I closed Chrome and reopened and reloaded the URL then it worked.

mikeduarte avatar Nov 16 '17 14:11 mikeduarte

+1

Just had the same issue, Chrome Linux Desktop with the URL:

https://www-vestibulares-com-br.cdn.ampproject.org/c/s/www.vestibulares.com.br/anhanguera/amp/index.html

Console message:

Blocked form submission to '' because the form's frame is sandboxed and the 'allow-forms' permission is not set.

Trying in a new tab solved the issue.

caiotomazelli avatar Jan 10 '20 22:01 caiotomazelli

I also encountered this problem while trying to use the AMP cache. When I visited the AMP cached page link, if the status code is 304 and my form expresses the request, this kind of error will appear in the console.“Blocked form submission to '' because the form's frame is sandboxed and the 'allow-forms' permission is not set.”

Xuanmoi avatar Nov 23 '21 09:11 Xuanmoi