Skip to content

fix(cloudflare): provide runtime for local D1 migrations - #1009

Merged
sam-goodwin merged 2 commits into
alchemy-run:mainfrom
patrikduksin:agent/fix-local-d1-runtime
Jul 30, 2026
Merged

sam-goodwin merged 2 commits into
alchemy-run:mainfrom
patrikduksin:agent/fix-local-d1-runtime

Conversation

@patrikduksin

@patrikduksin patrikduksin commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • provide the standalone local D1 gateway runtime while local migrations and imports run
  • add a regression test using the same RPC sidecar topology as alchemy dev

Root cause

When alchemy dev installs RpcProviderProxy, RpcProvider.providerServicesEffect leaves localRuntimeServices() out of the caller because RPC-backed providers consume those services in the sidecar.

D1's local provider is not RPC-backed, though: its migration and import lifecycle still executes in the main process. withLocalD1Executor therefore reached LocalD1Gateway without cloudflare-runtime/Runtime.

Providing localD1GatewayRuntime directly at those two lifecycle call sites makes their standalone dependency explicit while preserving the existing in-process and RPC provider behavior.

Validation

  • confirmed the new RPC-sidecar test fails without the fix with Service not found: cloudflare-runtime/Runtime
  • relevant local D1 tests: 3 passed
  • bunx bun@1.3.13 tsc -b
  • oxfmt --check

Closes #1007

@patrikduksin
patrikduksin marked this pull request as ready for review July 30, 2026 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local D1 migrations and imports fail in dev: missing cloudflare-runtime/Runtime

2 participants