cloudflare / cloudflare/workers-sdk

🐛 BUG: `wrangler d1` commands shouldn't read wrangler.toml if executing remotely

Open
#6,256 0 comments 0 reactions 1 assignee Claimed by @rozenmd View on GitHub
package:wrangler product:d1
Dominant language
TypeScript
Stars
4.5k
Forks
1.5k
Avg merge
3d 8h
Merged PRs (30d)
187

Description

### Which Cloudflare product(s) does this pertain to?

D1

### What version(s) of the tool(s) are you using?

latest

### What version of Node are you using?

latest

### What operating system and version are you using?

Mac

### Describe the Bug

If the user copies a correct config (known-good `database_name` and `database_id`) into wrangler.toml, and later changes the name without updating the id, wrangler will naively use the `database_id` provided - instead we should reach out to D1 each time to get that name's id.

This can also happen if they delete the DB via wrangler command and recreate it with the same name, forgetting to update wrangler.toml, as in https://github.com/cloudflare/workers-sdk/issues/3438

### Please provide a link to a minimal reproduction

_No response_

### Please provide any relevant error logs

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.