Skip to main content

Runbook: Cannot Read Properties of Undefined 'includes'

ServiceWebku x Tripla Page
Owner Team slack handle@bnl-dev-bali
Team's Slack Channel#bnl-teams-b

Table of Contents

  • [[#Important Links]]
  • [[#1. Triage]]
  • [[#2. Decision Point]]
  • [[#3. False Alarm]]
  • [[#4. True Incident]]
    • [[#4.1. Recover the System]]
    • [[#4.2. Clean up]]

Alert[Sentry Issue Link – TypeError includes undefined]
Affected URL/dashboard/sites/{site}/content/edit
Fix CommitMERGE PR

1. Triage

Goal: Confirm issue is caused by missing ?page= query parameter.

  1. Open Sentry issue.
  2. Confirm error message:
TypeError: Cannot read properties of undefined (reading 'includes')
  1. Access page without query parameter:
https://webku.bookandlink.com/en/dashboard/sites/{site}/content/edit
  1. Confirm ?page= is missing.
  2. Check browser console for:
undefined.includes(...)
  1. Confirm whether fix commit has been deployed.

2. Decision Point

  • IF accessing URL without ?page= causes crash and fix not deployed...

    • ➡️ Go to: [[#4. True Incident]]
  • IF fallback or redirect already works correctly...

    • ➡️ Go to: [[#3. False Alarm]]

3. False Alarm

  1. Confirm URL automatically redirects to:
?page=home
  1. Confirm no runtime error in console.
  2. Confirm no new Sentry logs for 15 minutes.

Post in Slack:

TypeError alert reviewed. Defensive validation working correctly.
No active incident.

4. True Incident

Impact:

  • Content Edit page crashes.
  • Users unable to edit site content.
  • Unhandled frontend exception logged.

4.1. Recover the System

Diagnostic Steps

  1. Confirm missing page query parameter.
  2. Confirm .includes() called on undefined value.

Remediation Plan

Option A:

  • Add validation before calling .includes().

Option B:

  • Provide default fallback value:
const page = query.page ?? "home";

Option C:

  • Automatically redirect to:
/content/edit?page=home
  1. Merge and deploy fix:
5cb3b6fa

Verification

  • Access URL without ?page= does not crash.
  • Default page loads.
  • No new TypeError logs in Sentry.

4.2. Clean up

  1. Confirm no failed content edits.
  2. Monitor Sentry for 30 minutes.
  3. Post resolution update in Slack:
TypeError resolved. Defensive validation deployed.
System stable.
  1. Update runbook if new edge cases discovered.