Netlify Function triggered on form submission includes incorrect payload

I have a Gatsby site running on Netlify. I wrote my first Netlify Function that is meant to be triggered on form submissions. The function gets triggered but the payload data contains information from a different form!

For example, I have two forms in my Netlify account: form-a and form-b. I am submitting form-a on my website and I see the submission for form-a in my Netlify account under the “Verified submissions” section. I expect the contents of form-a to be submitted as the payload to the Netlify Function. However, the payload data contains a submission from form-b even though I explicitly submitted form-a. The data for form-a is nowhere in the payload.

Why might this be happening? I appreciate your help.

Hard to tell why that’s happening without specific details, but one cause could be if your forms use the same form name. If that’s not it, please link to your live forms and I’ll take a look.

Hey Dennis! Thank you for getting back to me. This issue has been confusing us for a few days now. The form in question is this: https://prontopia.com/book-online/. If you inspect the network request after submitting the form, you’ll see that the form name is being submitted correctly. Yet, the data from this form isn’t what we see in the Function payload. Appreciate your help.

It looks like you have a service worker. As mentioned here: [Common Issue] Understanding & unregistering service workers, you can definitely run into a lot of issue if you have one running on your site. Could you de-register and disable it and let me know if that helps?