Skip to content

rawOpensaasContext is a one-shot promise: a boot before the database is reachable poisons createAuth for the process #1377

Description

@borisno2

The problem

The generated rawOpensaasContext is a one-shot promise. If the process boots before its database accepts connections, the promise rejects once and stays rejected for the life of the process, and everything built on it — notably createAuth, which wraps it in a lazy Proxy — rejects on every subsequent request.

Found on PR #1375 (issue #1170): the Playwright harness started Next before the sidecar was reachable and every /api/auth/* route failed until restart. The harness now serves under opensaas dev, which sequences the database first, so the e2e suite no longer hits it. A production cold start racing a database blip would.

What to do

Decide the contract and make it true:

  • Either the promise retries construction on failure (a rejected first attempt does not poison later ones — memoise only success), or
  • The generated context refuses to be created before the database is reachable and says so, and the guidance tells deployers to sequence accordingly.

Whichever is chosen: a test that rejects the first connection attempt and confirms the second succeeds (or confirms the documented refusal), and packages/core/CLAUDE.md / the deploy guide stating the behaviour.

Context


🤖 Generated with Claude Code

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

    ready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions