Skip to content

fix(events): serve events sitemap at /event/sitemap.xml and stop backend calls for non-numeric IDs#1088

Open
pr0m3th3usEx wants to merge 5 commits into
mainfrom
fix-events-list-sitemap-not-found
Open

fix(events): serve events sitemap at /event/sitemap.xml and stop backend calls for non-numeric IDs#1088
pr0m3th3usEx wants to merge 5 commits into
mainfrom
fix-events-list-sitemap-not-found

Conversation

@pr0m3th3usEx

@pr0m3th3usEx pr0m3th3usEx commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Problem

Two related issues surfaced from crawler/bot traffic hitting /event/sitemap.xml:

  1. Events sitemap returned 404. The events sitemap lived at
    app/(general)/event/[id]/sitemap.tsinside the dynamic [id] segment. As a
    result /event/sitemap.xml was never served as a sitemap; instead [id] matched
    the literal string "sitemap.xml" and rendered the event page tree, which 404'd.

  2. Stray backend calls + error noise. Because non-numeric segments reached the
    event page, eventOptions called zenaoClient.getEvent({ eventId: "sitemap.xml" }),
    and the backend failed with strconv.ParseUint: parsing "sitemap.xml": invalid syntax.
    These bot-triggered errors were captured by Sentry/OTel and added log noise.

Changes

  • Move the events sitemap up one level: app/(general)/event/[id]/sitemap.ts
    app/(general)/event/sitemap.ts. Now /event/sitemap.xml correctly serves the list
    of event URLs and no longer falls through to the [id] page route. This mirrors the
    existing blog pattern (app/(general)/blog/sitemap.xml/route.tsx, a sibling of [slug]).

  • Centralize a numeric-id guard in eventOptions (lib/queries/event.ts): reject
    non-numeric IDs before hitting the backend, so crawler paths like /event/<garbage>
    no longer trigger getEvent / strconv.ParseUint errors. All callers are covered;
    server pages' existing try/catch → notFound() turns it into a clean 404.

  • Remove redundant inline guards and debug logging that were previously sprinkled
    in event/[id]/(general)/layout.tsx and (tabs)/page.tsx, now that validation lives
    in one place.

Sentry source maps upload fix

Production/preview builds were failing source map upload with error: Project not found. The Sentry config in next.config.ts still used the wizard placeholders (org: "sentry", project: "zenao") and let sentry-cli default its URL to sentry.io, which doesn't match our self-hosted instance at sentry.samourai.pro.

Changes

  • next.config.ts: read org/project from SENTRY_ORG_SLUG / SENTRY_PROJECT_SLUG, and set sentryUrl from SENTRY_URL instead of hardcoding/defaulting. Needed to be set in. Netlify
  • .env.example: documented SENTRY_ORG_SLUG, SENTRY_PROJECT_SLUG, SENTRY_URL, SENTRY_AUTH_TOKEN.
  • Rotated SENTRY_AUTH_TOKEN (needs the org:ci scope; the previous token was invalid/exposed in build logs).

Deployment note: these four env vars must be set in CI/hosting for source map upload to succeed. Upload is non-fatal and is already skipped in development, so missing vars won't break builds — only stack-trace readability in Sentry.

Testing

  • GET /event/sitemap.xml200, content-type: application/xml, body lists
    https://zenao.io/event/<id> entries; no GetEvent error in backend logs.
  • GET /event/<non-numeric>404 with no backend call.
  • GET /event/<valid-id>200, event renders normally.

@netlify

netlify Bot commented Jun 29, 2026

Copy link
Copy Markdown

Deploy Preview for zenao failed.

Name Link
🔨 Latest commit 10be199
🔍 Latest deploy log https://app.netlify.com/projects/zenao/deploys/6a4241ed4ea6b80008db51dc

@pr0m3th3usEx pr0m3th3usEx changed the title fix(events): serve events sitemap at /event/sitemap.xml and stop backend calls for non-numeric IDs## Problem Two related issues surfaced from crawler/bot traffic hitting /event/sitemap.xml: 1. **Events sitemap returned 404.** The events sitemap lived at app/(general)/event/[id]/sitemap.ts — *inside* the dynamic [id] segment. As a result /event/sitemap.xml was never served as a sitemap; instead [id] matched the literal string "sitemap.xml" and rendered the event page tree, which 404'd. 2. **Stray backend calls + error noise.** Because non-numeric segments reached the event page, eventOptions called zenaoClient.getEvent({ eventId: "sitemap.xml" }), and the backend failed with strconv.ParseUint: parsing "sitemap.xml": invalid syntax. These bot-triggered errors were captured by Sentry/OTel and added log noise. ## Changes fix(events): serve events sitemap at /event/sitemap.xml and stop backend calls for non-numeric IDs Jun 29, 2026
@pr0m3th3usEx
pr0m3th3usEx force-pushed the fix-events-list-sitemap-not-found branch from 4d6d251 to ba17add Compare June 29, 2026 09:03
@pr0m3th3usEx
pr0m3th3usEx force-pushed the fix-events-list-sitemap-not-found branch from ba17add to 39f659f Compare June 29, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant