{
  "id": 1493223,
  "title": "The `doRegister is not defined` Bug: How a Live-Count Feature Broke Registration",
  "url": "https://urgent.news/2026/08/17/the-doregister-is-not-defined-bug-how-a-live-count-feature-broke",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-17T13:51:29.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/minia2a/the-doregister-is-not-defined-bug-how-a-live-count-feature-broke-registration-3239"
  },
  "original_language": "en",
  "account": "A user clicked \"Get 500 Free Credits\" on the registration page, but nothing happened. The console displayed an error: \"Uncaught ReferenceError: doRegister is not defined.\" The issue arose because the button's onclick attribute called the \"doRegister\" function, but this function was not defined in the script block that ran due to timing problems. The problem stemmed from a live-count feature that displayed the number of available services on the registration page. The page initially showed a hardcoded number of 154 services, which was incorrect as the actual number grew over time. The developer added a helper function, \"loadLiveStats,\" to fetch the live count from the server and update the relevant spans. However, the \"live-svc-browse\" span that needed to be updated did not exist in the DOM initially; it only appeared after a successful registration. As a result, when the \"loadLiveStats\" function attempted to update the span before it was present, it threw a TypeError, causing the entire inline script block to fail, preventing the \"doRegister\" function from being defined. The root cause was a timing issue: the code that ran at page load tried to update elements that only existed after certain asynchronous operations completed. To fix the issue, the developer implemented three changes: added null-guard checks before accessing elements, called \"loadLiveStats\" again after the success message was injected to ensure the live count was up-to-date, and provided stable IDs for the elements being updated to avoid guessing the structure.",
  "summary": "This is a submission for DEV's Summer Bug Smash: Smash Stories powered by Sentry . The symptom: a button that did absolutely nothing A user hit \"Get 500 Free Credits\" on our registration page and nothing happened. No spinner, no error, no network request. The console had exactly one line: Uncaught ReferenceError: doRegister is not defined The button itself was as boring as it gets: <button…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}