On this page
What this issue is
A promise is JavaScript's way of saying 'this result will arrive later'. It ends in success (resolved) or failure (rejected). If it is rejected and nothing handles the failure, the browser raises an unhandled promise rejection and prints Uncaught (in promise) in the console.
Common sources on marketing pages: a fetch() to your form endpoint that returns a network error, an await without try/catch, a third-party widget (chat, booking, consent) that throws inside an async callback, or JSON.parse failing on an HTML error page returned by an API.
form.addEventListener('submit', async (e) => {
e.preventDefault();
// If this request fails or returns invalid JSON, the promise rejects
// and nothing catches it. The visitor sees no change.
const res = await fetch('/api/lead', { method: 'POST', body: new FormData(form) });
const data = await res.json();
window.location.href = '/thank-you';
});Why it costs you leads or sales
The page does not crash, so the problem is easy to miss. But the code after the failed await never runs. That can mean the lead is not saved, the redirect to the thank-you page never happens, or the conversion tag that fires on that page never loads. The visitor sees nothing happen, clicks again or leaves.
- Visitor submits formClick handler runs
- fetch() to APIRequest fails or returns bad JSON, promise rejects
- Redirect to thank-youNever reached
- Conversion tagNever fires
- Lead in CRMNever created
The failed request is not caught, so every later step is skipped.
How to check if your site has it
Open DevTools on the funnel page
In Chrome press F12 (Cmd+Option+I on Mac) and open the Console tab. Tick 'Preserve log' so messages survive navigation.
Walk the journey
Load the page, fill the form, submit, and continue through each step. Look for red lines starting with 'Uncaught (in promise)'.
Check the Network tab
Find the request that ran just before the error. A failed status (4xx, 5xx, blocked, CORS) or an HTML response where JSON was expected is the usual cause.
Log them globally
Paste the listener below in the console, then repeat the journey to see every rejection with its reason.
Test with problems
In the Network tab set throttling to Offline or block the API URL, then submit. If nothing happens on screen, the failure is not handled.
window.addEventListener('unhandledrejection', (event) => {
console.warn('Unhandled rejection:', event.reason);
});How to fix it
The fix is the same everywhere: handle the failure where the promise is made, and give the visitor a result. Where you do this depends on who owns the code.
form.addEventListener('submit', async (e) => {
e.preventDefault();
const button = form.querySelector('[type="submit"]');
button.disabled = true;
try {
const res = await fetch('/api/lead', { method: 'POST', body: new FormData(form) });
if (!res.ok) throw new Error('Request failed: ' + res.status);
await res.json();
window.location.href = '/thank-you';
} catch (err) {
console.error(err);
document.querySelector('#form-error').textContent =
'Sorry, we could not send your details. Please try again.';
button.disabled = false;
}
});Wrap awaits in try/catch
Or add .catch() to promise chains. Check res.ok before parsing JSON.
Show an error message
Tell the visitor what happened and re-enable the submit button.
Add a global listener
Use window.addEventListener('unhandledrejection', ...) to send errors to your error tracker.
Find the source script
The console error shows a file path. If it is under /wp-content/plugins/ or /themes/, that plugin or theme is the source.
Update or isolate it
Update the plugin, then deactivate plugins one at a time on a staging copy to find the culprit. Contact the vendor with the console message.
Fix your own code
For custom snippets (Code Snippets plugin, child theme), add try/catch as shown above.
Locate the file
Check the console path. Theme files sit under assets/ in Online Store > Themes > Edit code; app scripts come from the app.
Add error handling in the theme
Wrap fetch calls (for example to /cart/add.js) in try/catch and check response.ok.
Report app errors
If an app script causes it, disable the app embed in the theme editor to confirm, then contact the app developer.
Use Preview mode
Open Tag Assistant and watch the console while tags fire.
Fix Custom HTML tags
Add try/catch or .catch() inside any Custom HTML tag that uses fetch or async code.
Publish and retest
Submit the container version and repeat the journey.
Check custom code
Look in Project settings > Custom code and page-level custom code for async scripts.
Add handling
Wrap fetch or await calls in try/catch and show a message in a visible element.
Check embeds
If a third-party embed throws, contact its vendor or replace it.
Check custom code blocks
Review Custom JS/HTML elements and the funnel's tracking code settings for async code.
Add handling
Use try/catch around any fetch you added to forms or buttons.
Retest the funnel
Open the live funnel URL and submit a test lead with the console open.
How to confirm it's fixed
- Console shows no 'Uncaught (in promise)' while you complete the full journey
- With the API blocked or the network offline, the visitor sees a clear error and the button works again
- With the API working, the redirect and thank-you page load as before
- Conversion tags fire on the thank-you page (check in Network or the platform's debug view)
- The test lead arrives in the inbox and CRM
How to prevent it happening again
- Make try/catch or .catch() part of code review for any fetch or await
- Check res.ok before calling res.json()
- Add a global unhandledrejection listener that reports to your error tracking tool
- Re-test the whole funnel after theme, plugin, app or tag changes
- Run an automated journey check on a schedule so regressions are noticed quickly
How FunnelGuard handles this
FunnelGuard detects this today. When its robot visitor runs your journeys in Chromium, it captures page errors (the browser's pageerror events), which include unhandled promise rejections raised during the run. The check is tied to the step where the error occurred.
If a step fails, FunnelGuard re-checks from a second region before sending one alert (email, Slack, Teams, WhatsApp, webhook or PagerDuty) with a screenshot and a likely cause. It tells you where the error appeared; fixing the code is still up to you. The Free plan covers 1 site and 2 journeys with daily checks and no card, and paid plans start with a 3-day free trial.
Questions people ask
What does 'Uncaught (in promise)' mean?
It means a promise was rejected and no .catch() or try/catch handled the failure. The browser reports it in the console. The code that depended on that promise did not finish, which can silently break a form or tracking call.
How do I fix an unhandled promise rejection?
Wrap the awaited code in try/catch or add .catch() to the promise chain, check res.ok before parsing a fetch response, and show the visitor a message. Then add a global unhandledrejection listener to catch any that remain.
Why is my form not submitting and the console shows Uncaught (in promise)?
Most likely the request to your form endpoint failed or returned something that is not JSON, so the code after the await never ran. Check the Network tab for the failed request, then add error handling so the visitor gets feedback.
Can an unhandled promise rejection stop my tracking from firing?
Yes, if the rejection happens before the code that sends the tag or redirects to the thank-you page. Anything after the failed await is skipped, so the conversion may never be recorded.
How do I catch all unhandled promise rejections in the browser?
Use window.addEventListener('unhandledrejection', handler). The event's reason property holds the error. Use it to log or report errors, but still fix the source with try/catch where the promise is created.
Is an unhandled promise rejection the same as a JavaScript exception?
Not quite. A normal uncaught exception comes from synchronous code throwing, while a rejection comes from an async operation failing. Both show in the console and both can break a funnel step, but they are caught differently.
Does FunnelGuard detect unhandled promise rejections?
Yes. It captures page errors in Chromium while running your journeys, which include unhandled rejections, and alerts you with a screenshot and likely cause after a second-region re-check.
Related issues
- PRF-116Uncaught JavaScript exception on page loadFix guide
- PRF-117Console error on a funnel stepFix guide
- PRF-120JS error only after clicking submit breaks the formFix guide
- PRF-124CORS error blocking API call from the pageFix guide
- PRF-135Form submits but shows no feedback (silent failure)Fix guide
- PRF-137Error 'Something went wrong' shown after submitFix guide