* Add user-friendly error handling for file not found errors
Handle ENOENT errors with clear, actionable messages instead of raw error
codes. These are environmental issues where users reference files or
directories that don't exist, so we suppress Sentry reporting and show
the missing path with helpful guidance.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Mark macOS version errors as UserError in CLI package
Updates the CLI package to throw UserError instead of generic Error for
macOS version compatibility issues. This ensures version incompatibility
errors are properly classified as user-facing errors that shouldn't be
reported to Sentry.
Also includes changeset for this change.
* Update packages/wrangler/src/core/handle-errors.ts
Co-authored-by: Ben <4991309+NuroDev@users.noreply.github.com>
* Improve error message when creating duplicate KV namespace
When attempting to create a KV namespace that already exists, provide
a clear, user-friendly error message instead of the generic API error.
The new message explains that the namespace already exists and suggests
running `wrangler kv namespace list` to see existing namespaces with
their IDs, or choosing a different namespace name.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* user error in env types
* Improve error handling for Vite config transformations
Replace assertions with proper error handling when transforming Vite
configs. When Wrangler encounters a Vite config that uses a function
or lacks a plugins array, it now provides clear, actionable error
messages instead of crashing with assertion failures.
The check function gracefully skips incompatible configs with debug
logging, while the transform function throws helpful UserError messages
with examples of how to manually add the Cloudflare plugin.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix Wrangler test failures
- Fix vite-config tests by setting logger level to debug to capture debug messages
- Update snapshots for FormData boundary formatting changes in deploy and pages tests
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* wording
* Add FormData boundary normalization for cross-platform test consistency
Adds normalization code to ensure FormData boundaries format consistently
across different platforms (macOS vs Linux) in test snapshots.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Suppress network fetch errors from Sentry and show user-friendly messages
Add handling for "fetch failed" / "Failed to fetch" TypeError exceptions
to prevent them from being sent to Sentry and instead display helpful
error messages to users about network connectivity issues.
Changes:
- Add isNetworkFetchFailedError() function in handle-errors.ts to detect
generic network fetch failures
- Display user-friendly error message explaining common network issues
- Mark these errors as non-reportable to Sentry (environmental issues)
- Update sentry tests to use API errors instead of network errors for
testing reportable error behavior
- Add test coverage for network error suppression
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix tests
* fix tests
* fix tests
* remove duplicate calls
* format
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Ben <4991309+NuroDev@users.noreply.github.com>
* Add helper function to show or hide the cursor
* Watch cli directory in wrangler "dev" script
* containers: ssh UX improvements
Fix a few papercuts with the new container ssh command:
* Provide single-letter aliases for common SSH options (`-F` to specify
a config file, `-o` to specify options, `-i` to set the private key)
* Allow `-o` to be used multiple times for setting multiple options
* Show the cursor when the SSH process starts. The library that
Wrangler uses to draw the interactive UI (clack) hides the cursor, so
it is not visible when the SSH shell starts. We need to manually make
it visible.
* Hard code some specific SSH options (ControlMaster, ControlPersist,
UserKnownHostsFile, and StrictHostKeyChecking). These don't make sense
to use with the way our SSH implementation works
* default max_instances to 20
* add log level to @cloudflare/cli
* fixup link to docs in error
* Update packages/containers-shared/src/images.ts
Co-authored-by: Edmund Hung <edmund@cloudflare.com>
---------
Co-authored-by: Edmund Hung <edmund@cloudflare.com>
* Move macOS version validation from @cloudflare/cli to miniflare
BREAKING CHANGE: Miniflare constructor now throws an error when running on
unsupported macOS versions (below 13.5) instead of just logging a warning.
- Move validateMacOSVersion, darwinVersionToMacOSVersion, and isVersionLessThan
functions from @cloudflare/cli to miniflare
- Add validateMacOSVersion call to Miniflare constructor (fails hard)
- Add warnMacOSVersion function for non-breaking warnings
- Update Wrangler to use warnMacOSVersion from miniflare
- Update C3 to use warnMacOSVersion from miniflare
- Remove old validation logic from @cloudflare/cli package
- Add comprehensive tests for both validation functions
- Update C3 build configuration and dependencies
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* Fix CI environment detection and address changeset feedback
- Update CI detection to check for any truthy CI value instead of just 'true'
- Add test cases for CI='1' and CI='yes' to ensure robustness
- Remove 'BREAKING CHANGE' language from changeset per user feedback
- Clarify that this makes errors more informative rather than introducing new errors
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* Revert macOS validation to @cloudflare/cli architecture
- Move validation functions back to @cloudflare/cli to keep C3 lightweight
- Remove miniflare dependency from C3 to avoid forcing workerd download
- Update imports in Wrangler, C3, and Miniflare to use @cloudflare/cli
- Remove validation logic from Miniflare constructor
- Update changeset description to reflect architectural change
This addresses @petebacondarwin's feedback that C3 should remain fast and
lightweight without requiring workerd installation.
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* Update pnpm-lock.yaml after removing miniflare dependency from C3
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* Remove unused validateMacOSVersion import from miniflare
This fixes the lint error 'validateMacOSVersion' is defined but never used
that was causing CI failures after the architectural revert.
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* Add validateMacOSVersion call to Miniflare constructor
This completes the architectural revert by ensuring Miniflare validates
macOS versions using the function from @cloudflare/cli, as requested
in the GitHub comment.
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* Update changeset to combine behavior from PR #10176 and current PR
- Consolidated into existing .changeset/silly-things-walk.md
- Added @cloudflare/cli as minor (new validation functions)
- Updated package versions to reflect architectural changes
- Removed duplicate changeset file as requested by @petebacondarwin
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* Fix miniflare build to bundle @cloudflare/cli dependency
- Remove @cloudflare/cli from external dependencies list
- This allows validateMacOSVersion to be bundled and available at runtime
- Fixes CI failure where @cloudflare/cli was not available in miniflare
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* Refactor validateMacOSVersion to eliminate code duplication
- Combine validateMacOSVersion and warnMacOSVersion into single function with boolean parameter
- Add shouldThrow parameter to control error vs warning behavior
- Keep warnMacOSVersion as convenience wrapper calling validateMacOSVersion(false)
- Update Miniflare constructor to explicitly pass true for hard validation
- Addresses GitHub comment from @emily-shen about reducing duplicate code
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* Make changeset description more concise
- Simplify changeset to 2 sentences as requested by @emily-shen
- Remove verbose sections and overly enthusiastic language
- Keep essential information about macOS validation behavior
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* Address GitHub comments: simplify API and fix dependency management
- Remove warnMacOSVersion() function as requested by @petebacondarwin
- Update Wrangler and C3 to call validateMacOSVersion(false) directly
- Move @cloudflare/cli from dependencies to devDependencies in miniflare
- Remove special case filter in build.mjs since @cloudflare/cli is now bundled as devDependency
This addresses both GitHub comments on PR #10211
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* Apply formatting fixes from pnpm fix
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* Fix CLI tests after removing warnMacOSVersion function
- Remove warnMacOSVersion from import statement
- Update test suite to use validateMacOSVersion(false) instead
- Maintain same test coverage for warning behavior
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* Update lockfile after adding @cloudflare/cli devDependency to miniflare
- Fixes CI failure: 'Cannot install with frozen-lockfile because pnpm-lock.yaml is not up to date'
- Resolves dependency mismatch for @cloudflare/cli in miniflare package.json
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* Improve error message text to specify glibc 2.35+ requirement for Linux
Addresses @emily-shen's feedback to make Linux requirements more specific in both error and warning messages.
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* Change C3 to hard fail on unsupported macOS versions
Addresses @emily-shen's feedback to change C3 behavior from validateMacOSVersion(false) to validateMacOSVersion(true) for consistency with the requirement that C3 should hard fail on unsupported macOS versions.
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* Update changeset description to reflect C3 hard fail behavior
After addressing @emily-shen's feedback, C3 now uses validateMacOSVersion(true)
for hard fail behavior, matching Miniflare. Only Wrangler shows warnings.
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* Improve version validation robustness and update API
- Add regex validation to isVersionLessThan function to ensure M.m.p format
- Update test file to use new ensureMinimumMacOsVersion API with object parameters
- Add comprehensive test coverage for both new and deprecated functions
- Address @vicb's feedback about stricter version format validation
All tests pass locally and code follows repository standards.
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* Rename function and files from validateMacOSVersion to checkMacOSVersion
- Rename validate-macos-version.ts to check-macos-version.ts
- Rename validate-macos-version.test.ts to check-macos-version.test.ts
- Update all import statements to reference new file names
- Address GitHub feedback from @petebacondarwin
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* feat: add macOS version validation to prevent EPIPE errors
- Add validateMacOSVersion utility to check for macOS 13.5+ requirement
- Integrate validation early in both wrangler and create-cloudflare CLI startup
- Show helpful error message with DevContainer suggestion for unsupported versions
- Add comprehensive unit tests covering various macOS version scenarios
- Add changesets for both packages documenting the new feature
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* fix: correct Darwin version mapping in macOS validation test
- Use Darwin 22.4.0 to properly map to macOS 13.4.0 in test case
- Update expected version assertion to match correct mapping
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* fix: skip macOS validation in CI environments and add test coverage
- Add CI environment detection to prevent validation interference with test runners
- Add test case to verify validation is skipped when CI=true
- Follows existing pattern used in other test files
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* fix: add proper export for validateMacOSVersion and fix test environment isolation
- Export validateMacOSVersion from wrangler package index for cross-package usage
- Add vi.unstubAllEnvs() to test beforeEach to prevent CI environment interference
- Update create-cloudflare to import validateMacOSVersion from wrangler package
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* fix: address GitHub comment and cross-package import bundling issues
- Move validateMacOSVersion export from index.ts to cli.ts as requested by @petebacondarwin
- Add wrangler to external dependencies in create-cloudflare build config
- Prevents esbuild from bundling wrangler's sqlite and blake3-wasm dependencies
- Resolves TypeScript import errors and build failures in create-cloudflare
- Follows pattern used by other packages that import from wrangler
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* fix: properly isolate CI environment variable in macOS validation tests
- Add vi.stubEnv('CI', '') to tests that expect validation to throw
- Prevents CI environment from interfering with test execution
- Resolves 2 failing tests causing 5 CI suite failures
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* fix: change changeset from minor to patch for macOS validation feature
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* fix: revert changeset to minor for macOS validation feature
This is a new stable feature, not a bugfix, so it should be classified as 'minor' according to CONTRIBUTING.md guidelines. This resolves the v3 backport CI failure that was triggered by the patch classification.
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* refactor: move macOS validation to @cloudflare/cli to resolve cross-package dependencies
- Move validateMacOSVersion function from wrangler to @cloudflare/cli package
- Update imports in both wrangler and create-cloudflare to use @cloudflare/cli
- Remove external: ['wrangler'] from create-cloudflare build configuration
- Move tests to @cloudflare/cli package and update to use crash() instead of UserError
- Maintain all existing functionality while improving dependency structure
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* fix: revert macOS validation to throw errors instead of using crash()
- Replace crash() with standard Error throwing as requested by @petebacondarwin
- Update tests to expect thrown errors with specific error messages
- Maintain same validation functionality while avoiding process.exit() calls
- Both wrangler and create-cloudflare have proper error handling for thrown errors
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* feat: improve macOS validation error message as requested by @petebacondarwin
- Update error message to mention 'Cloudflare Workers runtime cannot run'
- Add link to workerd documentation for more context
- Update test expectations to match new error message format
- Maintain same validation functionality with better user experience
Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
* update eslint versions and ban direct console usage in Wrangler, Miniflare and C3
* fixup! update eslint versions and ban direct console usage in Wrangler, Miniflare and C3
* fixup! update eslint versions and ban direct console usage in Wrangler, Miniflare and C3
* fixup! update eslint versions and ban direct console usage in Wrangler, Miniflare and C3
* rebase catchups of new eslint errors
The workers-sdk defines an `isInteractive` test which (incorrectly) does
not check whether stdout is a TTY. This means that when piping output to
a file or to another process, UI elements like the spinner write ANSI
escape sequences to stdout where they are not properly interpreted.
Wrangler has its own separate interactivity test that does check that
stdout is a TTY. This commit updates workers-sdk to use the
`isInteractive` test from Wrangler (which checks that both stdin and
stdout are TTYs) and then updates Wrangler to use this function. This
both eliminates code duplication and also fixes the problem mentioned
above where escape sequences are written to non-TTY outputs.
In addition, the `logOutput` function that the spinner uses (which uses
code from the 3rd party `log-output` library) _unconditionally_ assumes
that stdout is a TTY (it doesn't even check!) and always emits escape
sequences. So when we are running non-interactively, we must use the
`logRaw` function to avoid emitting escape sequences.
While making this change, I also addressed the TODO on the
`isNonInteractiveOrCI` function by using that function throughout the
wrangler codebase.
* feat: add --experimental flag to allow access to experimental templates
* fix: do not crash if the chosen framework does not exist
* fix: offer to deploy workers with assets and no bindings
* feat: add experimental qwik workers + assets template
* feat: add experimental svelte workers + assets template
* feat: add experimental remix workers + assets template
* feat: add experimental astro workers + assets template
* feat: add hello world with assets template
* feat: add experimental solid workers + assets template
* feat: add experimental nuxt workers + assets template
* feat: filter the C3 help info when in experimental mode
* fix: mark new Workers + Assets experimental templates as "workers" platform
This avoids C3 from trying to create a Pages project for them.
Needed a bit of refactoring to ensure that these new templates still work even if not marked as "pages".
* feat: add experimental angular workers + assets template
* refactor: use mapped paths to import templates
* feat: add experimental docusaurus workers + assets template
* feat: add experimental gatsby workers + assets template
* add changesets
Follow up toi https://github.com/cloudflare/workers-sdk/pull/6029, this normalizes some more dependencies : `get-port`, `chalk`, `yargs`, `toucan-js`, `@typescript-eslint/parser`, `@typescript-eslint/eslint-plugin`, `esbuild-register`, `hono`, `glob-to-regexp, `@cloudflare/workers-types``
This is the first of a few expected patches that normalize dependency versions, This normalizes `undici`, `concurrently`, `@types/node`, `react`, `react-dom`, `@types/react`, `@types/react-dom`, `eslint`, `typescript`. There are no functional code changes (but there are a couple of typecheck fixes).
* Run prerelease using global pnpm
* Remove pnpm & yarn version import
* turbo-ify
* pnpm windows
* fixups
* split in JS
* fixups
* Actually run the tests 😅
* composite matrix
* chore: update repo to use pnpm 9.1.1
* chore: update GH Actions to use pnpm 9.1.1
* chore: use install-dependencies custom action across all GH workflows
Also moves the setup of the TURBO cache into that action.