Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wrangler] Output complete URL when deploying custom domains #8001

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

southpolesteve
Copy link

@southpolesteve southpolesteve commented Feb 2, 2025

The current CLI output for custom domains does not include the URL. In iterm2 (and probably other terminals) this means the link cannot be clicked. Adding the full URL to the output makes it easier to jump to the deployed URL with a single click.


  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because:
  • E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because:
  • Public documentation
    • TODO (before merge)
    • Cloudflare docs PR(s):
    • Documentation not necessary because: Minor change. Don't believe this is documented anywhere

@southpolesteve southpolesteve requested a review from a team as a code owner February 2, 2025 21:18
Copy link

changeset-bot bot commented Feb 2, 2025

⚠️ No Changeset found

Latest commit: f9e7b8b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

github-actions bot commented Feb 2, 2025

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13119829352/npm-package-wrangler-8001

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/8001/npm-package-wrangler-8001

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13119829352/npm-package-wrangler-8001 dev path/to/script.js
Additional artifacts:

cloudflare-workers-bindings-extension:

wget https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13119829352/npm-package-cloudflare-workers-bindings-extension-8001 -O ./cloudflare-workers-bindings-extension.0.0.0-v10f35b6bd.vsix && code --install-extension ./cloudflare-workers-bindings-extension.0.0.0-v10f35b6bd.vsix

create-cloudflare:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13119829352/npm-package-create-cloudflare-8001 --no-auto-update

@cloudflare/kv-asset-handler:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13119829352/npm-package-cloudflare-kv-asset-handler-8001

miniflare:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13119829352/npm-package-miniflare-8001

@cloudflare/pages-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13119829352/npm-package-cloudflare-pages-shared-8001

@cloudflare/unenv-preset:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13119829352/npm-package-cloudflare-unenv-preset-8001

@cloudflare/vite-plugin:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13119829352/npm-package-cloudflare-vite-plugin-8001

@cloudflare/vitest-pool-workers:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13119829352/npm-package-cloudflare-vitest-pool-workers-8001

@cloudflare/workers-editor-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13119829352/npm-package-cloudflare-workers-editor-shared-8001

@cloudflare/workers-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13119829352/npm-package-cloudflare-workers-shared-8001

@cloudflare/workflows-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13119829352/npm-package-cloudflare-workflows-shared-8001

Note that these links will no longer work once the GitHub Actions artifact expires.


[email protected] includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20250129.0
workerd 1.20250129.0 1.20250129.0
workerd --version 1.20250129.0 2025-01-29

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

Comment on lines 243 to 245
result = new URL(route, "https://").href;
} else {
result = route.pattern;
result = new URL(route.pattern, "https://").href;
Copy link
Contributor

Choose a reason for hiding this comment

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

Calling new URL() won't work here—these routes are not necessarily valid URLs, and can have wildcard patterns. I think this might have to resort to prepending the string https:// to custom domains?

e.g. "*.bar.com/foo/*" is a perfectly valid route, but new URL() won't parse it.

Copy link
Author

Choose a reason for hiding this comment

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

Gah. I was trying to do the "right" thing. The first version of this code just appended the protocol. Will go back to that

@emily-shen emily-shen added the e2e Run wrangler e2e tests on a PR label Feb 4, 2025
Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

I propose prepending only if it doesn't already start with http

@@ -238,11 +238,11 @@ export const validateRoutes = (routes: Route[], assets?: AssetsOptions) => {
};

export function renderRoute(route: Route): string {
let result = "";
let result = "https://";
Copy link
Contributor

Choose a reason for hiding this comment

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

@southpolesteve
Copy link
Author

I'm realizing there is a bug behind the bug:

if (route.pattern.includes("/")) {

If you give a fully specified protocol in the custom domain it errors on that line. But the code there is only checking for paths

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e Run wrangler e2e tests on a PR
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

4 participants