Home
Support Forums

Submission-created not triggered on form submit

Site names: ogilvie-fleet-staging.netlify.app, ogilvie-fleet-live.netlify.app.

The staging site is used by devs to test new features and releases, the live site is used for the final product. We have created a simple contact us form that, when submitted, triggers the submission-created function and emails the customer with a thank you and emails the staff with the detail in the form. This successfully runs on the staging site but not on the live site, even though the codebase is exactly the same, they are both attached to the master branch and I can’t see any other differences on the Netlify UI.

Any help would be much appreciated, thanks!

Hiya, @aidanm1999

Welcome to the Netlify Forums. Sorry you are having trouble getting your forms to work.

This Support Guide is the first port of call to debug any forms issues. There are also many other Support Guides for forms - you can find them here: #Netlify-support:support-guides

We also recommend trying to search the forums or look at topics tagged Netlify forms if you haven’t already - it’s likely your question was already asked by someone else!

If you are still having problems, please provide more information such as what you have already tried, your form name as it exists in the UI, etc. :slight_smile:

Hi Hillary,

Many thanks for the fast reply. I have checked out the support guide and related topics but they don’t seem to have the same issue as we are facing. The form names are Contact, OverseasTravelRequest and DemoRequest. None work. If you are testing, please use the contact form (as opposed to the other forms) on the live site as we have temporarily redirected hooks to a different email address.

What we have tried/checked

  1. Cleaning cache and redeploying
  2. Simplifying the function so that it just logs a success message
  3. Checked the env vars to see if they differ in any important way
  4. Checked the build logs (both the same/no errors)
  5. Both are running form detection
  6. Both have the same build process
  7. Forms successfully submit, store the form on Netlify UI & trigger email hooks

Steps to reproduce

  1. Go to the contact page (staging)
  2. Fill out the form with dummy data (email address should be your valid email to receive an email)
  3. Submit the form
  4. You should be redirected to the success page
  5. I will receive an email from the email hook, an email with the details entered and the email address you inputted will be sent an email confirming your submission
  6. Go to the contact page (main)
  7. Fill out the form with dummy data (email address should be your valid email to receive an email)
  8. Submit the form
  9. You should be redirected to the success page
  10. I will receive an email from the email hook but no other emails will be sent

This is interesting. You’re absolutely correct. You’re receiving the (verified) submissions in the UI, but the function itself is not triggering at all.

What’s interesting is, there are no logs for that function ever being called - it’s as if it just doesn’t exist. For the staging, I can see the logs, not for production. It does seem like someone tried to directly call the function endpoint in the browser on Sep 15. But, that’s about it.

If it’s possible, could you try removing the custom domain from the production website, trigger a re-deploy and check?

Hi @hrishikesh, thanks for the help! We would be very hesitant to remove the custom domain as we have quite a large traffic flow towards the site (around 40 users/h). We could potentially try this as a last resort at 3 AM GMT so that fewer customers are affected, but is there any other avenues we could take beforehand?

Well, you could setup another website from the same repo and add the custom domain to it so that we can check on this one.

Also, if you can deploy another website from the same repo (your staging one seems to be deploying from the same repo, could you deploy it as one more website) and the function works fine on that, it would again make me think it’s something going on with the domain, though I might be wrong.

Sounds good, I’ll test on a third site to triple check and get back to you soon!

Redeployed on a new site (https://objective-mestorf-7fc5c3.netlify.app) and works. We will test tonight and see how it goes.

That’s great to know. So yeah as expected the code is working perfectly fine.

The reason why I believe it might be the domain is because of this thread:

They had an issue where their domain was not resolving, but was connected to Netlify website. This is not the case for you, but that’s the closest thing I can think of at the moment.

Hi @hrishikesh, tested it out this morning and it seems to be an issue with the custom domain. I removed the custom domain, cleared cache and redeployed and the function is invoked exactly as expected. Then I try to add the domain name back in and the function isn’t called. I tried redeploying again but to no avail. Is there anything else we could try?

Great that we could narrow it down. I’m checking the DNS settings for your domain and this seems off to me:

This should point to ogilvie-fleet-live.netlify.app and not the apex domain. Could you change that and once you’re sure it has propagated, see how it goes?

Hi @hrishikesh, sorry for the delayed reply. Over the past couple of nights we have been testing this and it only seems to work when no custom domain is connected. We fixed the issue with the domain and then did the following:

  1. Unlinked the custom domain
  2. Rebuilt the site
  3. Tested - Working
  4. Linked the custom domain
  5. Tested - Failing
  6. Rebuilt the site
  7. Tested - Failing

We also tried the above with two other test domains with no luck. Is there anything else we could try?

Just to try, could you use Netlify DNS to see if it makes a difference?

Personally, I don’t believe it should, but it might not hurt to try. But if there are technical limitations about using Netlify DNS, let us know and we can try to think of some more alternatives, though none come to mind as of now.

Unfortunately a third party manages the DNS config for the domain, so we can’t move it. I could try adding a dummy domain to Netlify, remove the live domain and test it to see? The only issue is that it would be another overnight test, is there anything else we could try?

Hey there! Looks like some recent DNS changes were made. The www is correctly configured to look at the live site and we’re seeing function invocations.

How do things look at your end now?