Skip to content

Direct Cloudflare deploys create Hyperdrive with query caching on #404

Closed

Description

@Brooooooklyn

Problem

void deploy --platform cloudflare creates the Hyperdrive with the origin only. Cloudflare then uses its default query cache, so a read right after a write can return stale data for up to about 75 seconds.

void deploy --platform cloudflare
  └─ cf hyperdrive create --body { name, origin }      no caching setting
       └─ Cloudflare default: caching on (max_age 60 s + stale_while_revalidate 15 s)

app: INSERT ... ; SELECT ...   →  the SELECT can come from the cache
  • Code: packages/void/src/cli/cloudflare-operation-process.ts (hyperdrive.create).
  • Better Auth reads sessions through HYPERDRIVE (packages/void/src/runtime/better-auth-shared.ts), so a new session can look missing right after sign-in.
  • The managed platform creates and updates project Hyperdrives with caching off, and turns it off for existing ones on deploy (fix(platform): address Cloudflare end-to-end deployment failures #399).

Questions

  1. Should a Hyperdrive that Void creates on a direct deploy send caching: { disabled: true }?
  2. Should Void change an existing Hyperdrive that it adopted by name?
  3. A Hyperdrive that the user names in cloudflare.hyperdrive belongs to the user. Void should probably leave its settings alone. Confirm this.

Tests

  • A direct deploy that creates a Hyperdrive sends caching off.
  • A user-supplied cloudflare.hyperdrive id is not changed.
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

    enhancementNew feature or request

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions