Netlify Forms not sending when submitting while on custom domain

Hi there,

Not sure how to even diagnose this issue, but when I submit a form while on the .netlify.app domain, the form submits successfully, and can be viewed in the Forms section of netlify.

I should note that I have not tested this on the production domain, I’m just testing on the dev branch sub-domain.(dev–site.netlify.app, and dev.site.co.uk), would like to avoid pushing to production branch for the sake of testing.

However, when I use my custom domain (dev.site.co.uk, the submission apparently succeeds (status 200, nothing throws an error so my catch picks nothing up), but nothing shows up in the Forms section of netlify, not even in the spam section.

My question is, would a domain cause such an issue? Or is there something else at stake here? It seems to me that the code shouldn’t be an issue if it works on dev–site.netlify.app right?

The only difference in the response message is the site domain, not sure if it’s also worth mentioning but in the response, the custom domain shows the index.html at the end whereas netlify.app doesn’t.

The submission code:

    handleSubmit = (e) => {
        e.preventDefault();
        fetch("/", {
            method: "POST",
            headers: { "Content-Type": "application/x-www-form-urlencoded" },
            body: this.encode({ "form-name": "contact-form", ...this.state })
        })
        .then(res => this.props.successCallback(res.status === 200 ? true : false))
        .catch((e) => {
            console.log("Error: " + e.message);
            this.props.successCallback(false);
        });
        this.props.submitCallback(true);
    };

Anyone have this issue before? Any ideas on how to fix it?

Thanks in advance!

Could you provide us site name or domain name?

I’d prefer not to. However I’ve ended up testing this on the production branch, using the custom domain and forms do send off, so must just be something with subdomains not sending forms properly.

Edit: finally found out the issue was that my subdomain was heavily cached, despite cache being disabled, trying to submit the form in incognito worked right away.