fix(wrangler): show friendly error when D1 export output is a directory#12065
Conversation
🦋 Changeset detectedLatest commit: 76d8846 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Pull request overview
Improves wrangler d1 export by replacing a low-level Node.js EISDIR error with a friendlier UserError when --output points to a directory.
Changes:
- Added a preflight
--outputpath check intended to detect directory paths and throw a descriptiveUserError. - Updated a comment spelling in the local export implementation.
- Added a changeset for a patch release of
wrangler.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/wrangler/src/d1/export.ts | Adds --output directory detection to produce a friendly error message before attempting to write. |
| .changeset/cute-pets-fry.md | Records the user-facing change in a patch changeset. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
edmundhung
left a comment
There was a problem hiding this comment.
Thanks for the PR! This should be testable. Take a look at packages/wrangler/src/tests/d1/ for examples of how D1 commands are tested. A test that verifies the error when --output is a directory would be a good addition. :)
Co-authored-by: Edmund Hung <me@edmund.dev>
This reverts commit 939f9ce.
…angningchen/workers-sdk into langningchen/d1-export-message
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@edmundhung Thanks for the feedback! I've updated the code to use |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
|
Hi @edmundhung, sorry to bother you. I've updated the branch to keep it in sync with main. It seems the CI workflows are awaiting approval to run. Whenever you have a moment, could you please trigger them? Thanks! |
Fixes #7629
Currently, when running
wrangler d1 exportwith a directory path passed to the--outputflag, it throws a low-level Node.jsEISDIRerror. This PR adds a check to verify if the provided output path is a directory and throws a descriptiveUserErrorinstead.A picture of a cute animal