Skip to content

wrangler uses local D1 when --remote flag is specified #9099

Description

@Shotster

Which Cloudflare product(s) does this pertain to?

D1

What versions & operating system are you using?

wrangler 4.11.1, macOS (Intel)

Please provide a link to a minimal reproduction

No response

Describe the Bug

When I use the following command in my local terminal...

wrangler d1 execute rate_limits_db --remote --command " 
  CREATE TABLE IF NOT EXISTS rate_limits (
    key TEXT PRIMARY KEY,
    last_request INTEGER
  );"

...I get the following error...

🌀 Executing on remote database rate_limits_db (local-rate-limits-db-id):
🌀 To execute on your local development database, remove the --remote flag from your wrangler command.

✘ [ERROR] A request to the Cloudflare API (/accounts/[redacted-cf-account-id]/d1/database/local-rate-limits-db-id/query) failed.

  Invalid property: databaseId => Invalid uuid [code: 7400]

This indicates wrangler is using the id of the local D1 instance of the same name despite the --remote flag being used, which seems incorrect. IOW, the name of the local and remote DB is the same, but the id is different of course; and wrangler is using the wrong one.

Please provide any relevant error logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions