Skip to content

Railway deploy blocked: 11 Stripe billing tests fail in server/ on CI #69

@masonwyatt23

Description

@masonwyatt23

Symptom

deploy-server.yml is blocked on every push to main because the Run tests gate fails. The deploy step never runs, so the Railway server has not received a deploy in this pipeline since at least 2026-05-15 (commit 90df5772).

Confirmed pre-existing — NOT caused by PR #66 (v1.31 Phase 0) or PR #67 (Q1 Genome 2.0 + WAD-D). Same deploy failed identically on 90df5772 before either landed.

Reproduction

cd server && bun test

11 failures, all in billing tests:

Route Failing tests
`POST /billing/checkout` 4
`GET /billing/portal` 1
`POST /billing/webhook` 6

All share the same error:

TypeError: undefined is not an object (evaluating 'stripe.checkout.sessions')

Root cause (per the fix in #68)

The Stripe SDK constructed with a stub key lazily resolves resource attributes — `stripe.checkout`, `stripe.webhooks`, `stripe.billingPortal` come back as `undefined` on the CI bun runtime (1.3.14) but are fully populated on the local bun (1.3.13). A neighboring test (`admin-user-detail.test.ts`) already uses `mock.module("../src/lib/stripe.js", ...)` to side-step this; when both files share a process the side-effect leaks and makes `billing.test.ts` accidentally green locally. CI ran `billing.test.ts` early enough that the leak hadn't occurred, so the 11 calls against `stripe.checkout.sessions` / `stripe.webhooks.constructEvent` threw.

Fix shipped in #68

Option A from the issue plan: a test-setup module mock at the top of `server/tests/billing.test.ts` that calls `mock.module("../src/lib/stripe.js", ...)` before importing the app. Zero production code changed.

Impact (now resolving)

Failing run IDs

Fix tracked in PR #68.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions