Skip to content

Conversation

@jonasfroeller
Copy link

@jonasfroeller jonasfroeller commented Dec 22, 2025

fixes projects with dotted names and other naming conventions
see https://developers.cloudflare.com/workers/wrangler/configuration/#:~:text=assets%2Donly%20Workers.-,name,-string

Error: Processing wrangler.jsonc configuration:
  - Expected "name" to be of type string, alphanumeric and lowercase with dashes only but got "xxx.example.com".
    at readConfig (D:\Downloads\xxx.example.com\node_modules\wrangler\wrangler-dist\cli.js:50257:11)
    at getPlatformProxy (D:\Downloads\xxx.example.com\node_modules\wrangler\wrangler-dist\cli.js:288106:18)
    at get_emulated (file:///D:/Downloads/xxx.example.com/node_modules/@sveltejs/adapter-cloudflare/index.js:164:25)
    at Object.platform (file:///D:/Downloads/xxx.example.com/node_modules/@sveltejs/adapter-cloudflare/index.js:190:25)
    at internal_respond (D:\Downloads\xxx.example.com\node_modules\@sveltejs\kit\src\runtime\server\respond.js:217:41)
    at D:\Downloads\xxx.example.com\node_modules\@sveltejs\kit\src\runtime\server\respond.js:741:11
    at Server.respond (D:\Downloads\xxx.example.com\node_modules\@sveltejs\kit\src\runtime\server\index.js:172:17)
    at file:///D:/Downloads/xxx.example.com/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:562:35
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

Copilot AI review requested due to automatic review settings December 22, 2025 13:14
@changeset-bot
Copy link

changeset-bot bot commented Dec 22, 2025

🦋 Changeset detected

Latest commit: eab1fd8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
sv Patch

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical issue where Cloudflare Wrangler fails when project names contain dots, underscores, or other invalid characters. The solution adds a sanitization function that transforms project names from package.json to comply with Wrangler's strict naming requirements (alphanumeric lowercase with dashes only).

Key Changes:

  • Introduced sanitizeWranglerName() utility function that normalizes project names to Wrangler-compatible format
  • Applied sanitization to the Cloudflare adapter when generating wrangler.jsonc configuration
  • Added comprehensive unit tests covering edge cases like dots, Unicode characters, length limits, and invalid inputs

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
packages/sv/lib/cli/add/utils.ts Adds the core sanitizeWranglerName() function that converts project names to lowercase, replaces invalid characters with dashes, enforces 63-char limit, and removes leading/trailing dashes
packages/sv/lib/core/tests/wrangler.ts Comprehensive test suite covering basic sanitization, special characters, Unicode, length limits, and edge cases
packages/sv/lib/addons/sveltekit-adapter/index.ts Integrates the sanitization function when setting the Wrangler project name from package.json
packages/sv/lib/addons/_tests/sveltekit-adapter/test.ts Adds integration test assertions to verify generated wrangler.jsonc names are properly sanitized
.changeset/sanitize-wrangler-name.md Documents the fix for release notes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 22, 2025

Open in StackBlitz

npx https://pkg.pr.new/sveltejs/cli/svelte-migrate@861
npx https://pkg.pr.new/sveltejs/cli/sv@861

commit: eab1fd8

Copy link
Author

@jonasfroeller jonasfroeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right 😅

@jycouet
Copy link
Contributor

jycouet commented Dec 22, 2025

you're right 😅

I don't know if it's me or your AI that is right ><

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.

2 participants