Skip to content

Flaky/failing test: should create a QR code with custom options returns HTTP 400 #133

Description

@jaredwray

Summary

The integration test test/link.test.ts > Link QR Code > should create a QR code with custom options fails deterministically against the live Hyphen API with Error: Fetch failed with status 400.

Root cause: a server-side API contract change, not the SDK or its dependencies.

Evidence

  • The failing call is link.createQrCode(code, { title, backgroundColor, color, size: QrSize.MEDIUM }). The basic QR-create (empty body) returns 201; only the custom-options payload is rejected with 400. The SDK sends exactly the field names/values documented in the README.
  • Not a transport/dependency issue. The stack runs through @cacheable/net. We upgraded @cacheable/net 2.0.7 → 2.0.8 (which switches from bundled undici to the runtime's native fetch) — CI still returns the identical 400. A local echo-server repro confirmed undici@7.24.7 and native globalThis.fetch send byte-for-byte identical requests for this payload (same body, content-length, headers).
  • It regressed on the API side. This test and the createQrCode body were introduced together in PR chore: upgrading @cacheable/net to 2.0.1 #88, and main passed full CI — including this test — as recently as 2026-04-13. So the API previously accepted {"title","backgroundColor","color","size":"medium"} and now rejects it.

Current state (handled in PR #132)

  • The live integration test is skipped (test.skip) with a TODO pointing here.
  • A stubbed unit test (should build the request body when creating a QR code with options) was added so the custom-options request-body branches stay covered (100% coverage maintained).

To resolve

  1. With valid HYPHEN_* credentials, call the QR-create endpoint with the custom-options body and capture the 400 response body to see what the API now expects.
  2. Update src/link.ts createQrCode (and the README/types) to match the current contract — e.g. renamed/removed fields or a different color/size format.
  3. Un-skip the integration test in test/link.test.ts (remove test.skiptest) and confirm green.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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