Skip to content

bug: /mentorship/ad-hoc-timeline returns 500 when backend is unreachable (missing fallback) #299

Description

@yingliu-data

Bug Report

/mentorship/ad-hoc-timeline returns a 500 whenever the backend is unreachable, because the page has no static fallback (its sibling long-term page does).

  • src/lib/api.ts:60-71 — the pageData fallback map has no 'mentorship/ad-hoc-timeline' key, and responses/adHocTimeLine.json exists but is never imported.
  • src/pages/mentorship/ad-hoc-timeline.tsx:96-103getServerSideProps returns props.data = undefined when the fetch fails.

Reproduction

Backend down/misconfigured → fetchData returns { data: undefined }getServerSideProps returns data: undefined → Next.js throws "Error serializing .data" → 500 page. The long-term-timeline page falls back gracefully in the same situation.

Severity

Medium

Potential Risk

  • The ad-hoc timeline page hard-fails during any backend outage, instead of degrading to static content.

Suggested Fix

  • Add a 'mentorship/ad-hoc-timeline' entry to the fallback map wired to responses/adHocTimeLine.json.
  • Guard getServerSideProps so data is never undefined (return the fallback or a safe default).
  • Add a test simulating a failed fetch and asserting the fallback renders.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions