Netlify Form | CRA | ServiceWorker

Hi Netlify team,

I started to use the Netlify form feature on my app (https://alexandreteyar.netlify.app/) - awesome by the way - and I noticed that following the documentation for the AJAX implementation on apps build using CRA (Forms setup | Netlify Docs) there still was an issue with PWA apps.

The issue is that even when the app is offline - no internet connectivity - the service worker will serve a cached version of the index page (/) and therefore the feedback message will show a success when no form has actually been sent, see the following screenshot - the important parts being the network connectivity set to offline and the XHR request being served by the ServiceWorker resulting in a 200 success code:

image

Could you please document how to configure the ServiceWorker to ignore fetch POST requests intended to post Netlify form, or alternative ways to avoid the described issue?

Kind regards,
aress31

hi there,

maybe this is a good starting point?

Hi @perry,

Thanks for the reply but my goal is not to unregister my ServiceWorker, I know what ServiceWorker are and I need in on my application. I would like you to detail the steps to configure it so that it doesnt impact Netlify form submissions.

Best regards,
@aress31

Hi, @aress31, our support team isn’t able to consult on custom code in most cases and this service worker is custom code. This is covered on our Scope of Support page.

This community site is still a great place to ask questions like this one. It is a question relating to using Netlify and it is possible that someone else here will have an answer. I just want to be transparent about the types of questions our support team will have time to answer.