---
title: "How to monitor JavaScript errors in production | Rookflare"
description: "Which JavaScript errors break forms, menus and checkouts, a four-question rule to sort them, and three ways to hear about them without opening the console."
url: "https://rookflare.com/blog/javascript-errors-in-production/"
---

[Technical checks](https://rookflare.com/blog/category/technical-checks/)

# Monitor JavaScript errors in production: which ones matter

Most red lines in the browser console are harmless. A few quietly stop a form or a checkout from working. How to tell them apart, report them from real visitors and handle failed script loads after a deploy.

[Dalius Pamedytis CEO of Rookflare](https://rookflare.com/blog/authors/dalius-pamedytis/)

- Published: 14 November 2026
- Reading time: 5 min read

## Key takeaways

- An uncaught error stops the rest of that script, including any form handler set up after it.
- Sort errors by four questions: uncaught, your code, new since the release, on a money page.
- Failed script chunks after a deploy are common and have a known fix.
- Scheduled browser checks and real-user error reporting see different things and cover each other's gaps.

A JavaScript error in production matters when it stops code your visitors need, such as a form’s submit handler, a menu or the checkout. Visitors never report these errors; they see a button that does nothing and leave. To notice them without opening the console on every page, run scheduled checks in a real browser, report errors from real visitors, or both.

## Which JavaScript errors break a page

Most lines in a production console are noise. The ones below stop features from working:

- **Uncaught exceptions in your own code.** When a script throws during setup, nothing after it in that script runs. If that included the form’s submit handler, the form is broken.
- **Unhandled promise rejections.** A failed request that nobody catches often leaves a section that never loads.
- **Failed chunk loads after a deploy.** Visitors still on the old page request a script file that no longer exists.
- **Errors that only happen on mobile.** Different code paths and browser engines bring different bugs.

Here is what that looks like in a console. Two lines matter, two do not:

```
ERROR  Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')
       at signup-form.js:14
ERROR  Failed to fetch dynamically imported module: /assets/checkout-3f9a1c.js
WARN   Image with src "/img/hero.webp" was detected as the Largest Contentful Paint element
INFO   [consent] preferences loaded
```

The first error means the signup form never got its submit handler. The second means the checkout code did not load for anyone with a page cached from before the deploy.

## Sort console errors with four questions

A console with twenty red lines needs triage, not a fix for everything. Ask four questions about each error, in this order:

1. **Is it uncaught?** “Uncaught” in the message means no code handled it, so the script stopped. A logged error from `console.error` usually means the code caught the problem and carried on.
2. **Is it from your code?** Check the file name. Your domain or bundle means it is yours to fix. A vendor’s script means a ticket with the vendor. A `chrome-extension://` address means the visitor’s own browser.
3. **Is it new since the release?** An error that appeared an hour after a deploy is a regression. One that has been there for months can join the backlog.
4. **Is it on a money page?** Checkout, signup, booking and contact pages come first.

Four yeses mean fix it today, or roll back. Three mean fix it this week. Two or fewer usually means it can wait for the next planned release.

## Three ways to see errors without opening the console

Each approach sees a different slice of the problem. The table compares them.

| Approach | What it sees | What it misses |
| --- | --- | --- |
| Manual console checks | Everything on the pages you open | Everything you don’t open, every day you don’t look |
| Scheduled browser checks | Errors on chosen pages, with no visitors needed | Errors behind a login, after a click, or on rare devices |
| Real-user error reporting | Errors real visitors hit, with browser details | Pages nobody has visited yet; needs a script on your site |

Manual checks belong in the [routine for the first hour after a deploy](https://rookflare.com/blog/post-deploy-checklist/). The other two run without a person and fill each other’s gaps.

## Report errors from real visitors with two event listeners

The browser fires two events you can listen to. MDN documents the [window error event](https://developer.mozilla.org/en-US/docs/Web/API/Window/error_event) for exceptions and the [unhandledrejection event](https://developer.mozilla.org/en-US/docs/Web/API/Window/unhandledrejection_event) for promises nobody caught:

```
function  report ( kind ,  detail ) {
	navigator. sendBeacon (
		'/errors' ,
		JSON . stringify ({ kind, detail, page: location.pathname }),
	)
}

window. addEventListener ( 'error' , ( event )  =>  {
	report ( 'error' ,  `${ event . message } at ${ event . filename }:${ event . lineno }` )
})

window. addEventListener ( 'unhandledrejection' , ( event )  =>  {
	report ( 'rejection' ,  String (event.reason))
})
```

`sendBeacon` sends the report even while the page is closing. Send only what you need to debug, and leave out form values, user identifiers and anything else personal.

Scripts served from another domain report only “Script error.” with no details. MDN’s [script element reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script) explains the fix: add the `crossorigin` attribute and serve the file with a CORS header.

## Fix ChunkLoadError and “Failed to fetch dynamically imported module” after a deploy

Modern build tools split code into chunks with hashed names. After a deploy the old chunks are gone, so a visitor with the old page open fails to load the next one. In Chrome the error reads “Failed to fetch dynamically imported module”; webpack builds throw a `ChunkLoadError` saying “Loading chunk … failed”. Either way, that feature stays dead until a reload.

Vite documents this case in its [load error handling](https://vite.dev/guide/build#load-error-handling) section and fires a `vite:preloadError` event when a dynamic import fails. A reload picks up the new page:

```
window. addEventListener ( 'vite:preloadError' , ()  =>  {
	window.location. reload ()
})
```

Two server-side habits prevent most of these errors. Serve the HTML with `Cache-Control: no-cache` so browsers check for a new version, and keep the previous build’s chunks for a day after each deploy.

## Filter out noise before it reaches anyone

A useful error feed drops lines that say nothing about your page. These are safe to ignore in most setups:

- **“ResizeObserver loop” messages.** Browsers emit them in normal layout work.
- **“Script error.” with no details.** These come from cross-origin scripts; fix the source as shown above instead.
- **Extension URLs.** `chrome-extension://`, `moz-extension://` and `safari-web-extension://` errors come from the visitor’s browser.
- **Requests blocked by the client.** `net::ERR_BLOCKED_BY_CLIENT` usually means an ad blocker stopped an analytics script.

Keep third-party errors in a separate group rather than dropping them. A broken payment or consent script is worth knowing about, even if the fix is a ticket to the vendor.

## Do I need an error tracking service?

An error tracking service is worth it when visitors log in, fill multi-step forms or pay. Those errors happen after clicks that no scheduled check makes. The service collects the errors real visitors hit, with stack traces and browser details. For a brochure site, scheduled checks on the key pages plus the two listeners above often cover what matters.

The cost is one more script on every page and a privacy question. Error reports can carry page addresses, IP addresses and browser details, so check what the service stores and keep form values out of it.

## Run the scheduled browser check automatically

Rookflare runs the scheduled kind of check. Each scan opens your monitored pages in Chromium at desktop and mobile width, scrolls through them, and records uncaught exceptions and messages logged with `console.error`. It drops the noise in the list above and groups the same error across pages into one issue for the website. Uncaught exceptions get a higher severity than console errors. The [website health monitoring](https://rookflare.com/website-health-monitoring/) page shows what an issue contains.

The scan only loads and scrolls the page. Rookflare does not click, fill forms or log in, so errors that need an action stay with real-user reporting. Pairing the error check with [critical element monitoring](https://rookflare.com/blog/critical-elements-monitoring/) covers part of that gap: a missing checkout button shows up even when no error is logged.

## Questions

### Why does the error only happen on my phone?

Mobile browsers take different code paths: touch events, smaller viewports, a different engine on iOS. Open at least one money page on a real phone after each release; the [bugs that only show on mobile](https://rookflare.com/blog/mobile-vs-desktop-bugs/) follow similar patterns.

### Are warnings in the console a problem?

Usually not. Warnings flag deprecated APIs or performance hints; read them during planned work, not during an incident.

## Share this article

Written by

## [Dalius Pamedytis](https://rookflare.com/blog/authors/dalius-pamedytis/)

CEO of Rookflare

Dalius is the CEO of Rookflare and the engineer who builds it, from the Playwright scanner that captures every page to the dashboard where you review what changed. Day to day he also works on large marketing websites and dashboards, so he has seen how a quiet release can break a checkout button or a sign-up form. He writes about what actually breaks on real websites and the simplest way to catch it before your visitors do.

[More from Dalius Pamedytis](https://rookflare.com/blog/authors/dalius-pamedytis/)

14-day free trial

Check any page for free

Add your website and pick the pages that matter. Rookflare checks them every day, with desktop and mobile screenshots and technical checks.

[Start free trial](https://app.rookflare.com/register/)

## Keep reading

- Technical checks

  ### [How to know if a WordPress plugin update broke your site](https://rookflare.com/blog/wordpress-plugin-update-broke-site/)

  WordPress rolls back a plugin auto-update only when it hits a PHP fatal error. A broken layout, a dead slider or a missing buy button stays live until someone looks. A routine for before and after updates, with WP-CLI commands, rollback steps and an automatic check.

  [Dalius Pamedytis](https://rookflare.com/blog/authors/dalius-pamedytis/)

  19 November 2026 10 min read

- Technical checks

  ### [Contact form stopped working: how to find the broken step](https://rookflare.com/blog/contact-form-stopped-working/)

  The form shows, the visitor clicks Send, and no message arrives. Six steps sit between the page and your inbox. How to test each one, read the symptom and choose checks that tell you next time.

  [Dalius Pamedytis](https://rookflare.com/blog/authors/dalius-pamedytis/)

  16 November 2026 8 min read

- Technical checks

  ### [Monitor your checkout button, signup form and key elements](https://rookflare.com/blog/critical-elements-monitoring/)

  If the booking button disappears, nobody files a bug report. They just stop booking. How to pick the few elements a page cannot lose, write selectors that survive a redesign and check they are really visible.

  [Dalius Pamedytis](https://rookflare.com/blog/authors/dalius-pamedytis/)

  14 November 2026 6 min read

## Run a free check on your website

See in under a minute whether a page answers, has a valid certificate and working links. It is a one-time check of one page, free and without signup.

Or [start the free trial](https://app.rookflare.com/register/), no card needed. Rookflare then checks your site every day and alerts you when something breaks. From €19 a month (provisional).
