Repository navigation
Fix theme profile for URLs with a query string and report redirects - #8989
Merged
Merged
Conversation
MillanWangShopify
added this pull request to stack #8990
October 22, 2026 16:04
MillanWangShopify
marked this pull request as ready for review
October 22, 2026 16:07
MillanWangShopify
force-pushed
the
theme-profile-redirect-error
branch
from
October 22, 2026 17:41
c24724f to
4144739
Compare
karreiro
approved these changes
Oct 23, 2026
karreiro
left a comment
Contributor
There was a problem hiding this comment.
Thank you, @MillanWangShopify!
isaacroldan
approved these changes
Oct 23, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 23, 2026
Split the --url into a path and a query before rendering. The renderer appends its own query, so a --url with a query string produced a malformed URL that dropped _fd=0, and stores with a custom primary domain answered with a 301. Reject a --url that can't be parsed, or that starts with //, instead of crashing or profiling another page. Raise an AbortError with the redirect destination when the profiled page redirects. Only suggest a new --url when it differs from the requested one, flag destinations on other hosts, and point to --store-password for /password. Raise an AbortError for other non-200 responses too, so they are reported as expected errors instead of crashes.
isaacroldan
force-pushed
the
theme-profile-redirect-error
branch
from
October 23, 2026 09:40
4144739 to
e85a56f
Compare
isaacroldan
enabled stacked auto-merge
October 23, 2026 09:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
Vault issue: https://vault.shopify.io/teams/16949-Dev-Experience/issues/92474-error-bad-response-301
shopify theme profile --url <path>fails withError: Bad response: 301:, with no hint about the cause, and it's reported to Bugsnag as an unexpected crash.--urlwith a query string.profilepassed the whole--urlas the path, and the renderer appends its own?_fd=0&pb=0. That built/search?q=kw?_fd=0&pb=0, which drops_fd=0, so stores with a custom primary domain redirect to that domain.theme devdoesn't have this bug because it already passes the path and query separately./passwordon password-protected stores.WHAT is this pull request doing?
--urlinto a path and a query before rendering. The#fragmentis dropped, and a user-supplied_fdorpbis removed so the renderer's values always apply (the param list is now exported fromstorefront-renderer.ts). An absolute--urlis accepted, and only its path and query are used; the flag description now says so.--urlthat can't be parsed (it used to throw aTypeError) or that starts with//(it was parsed as a host, so another page was profiled).AbortErrorwhen the page redirects, and shows the destination without_fd/pb:--url,/passwordsuggests checking--store-password.Redirects aren't followed automatically.
AbortErrorfor other non-200 responses, with the status, the request ID, and the body only when it's JSON or short (never a full HTML page). This includes storefront 5xx responses: they aren't caused by the user, but the CLI can't act on them, so reporting them as CLI crashes in Bugsnag only adds noise.Out of scope: why a password-protected preview render can still get a 302 to
/passwordafter the password check passes.Before:
After (page that redirects):
How to manually test your changes?
On a dev store you own, ideally one with a custom primary domain:
Both should return a profile. Then add a URL redirect (Admin → Content → Menus → URL redirects) and profile its source path: the error should suggest the destination.
Checklist
patchfor bug fixes ·minorfor new features ·majorfor breaking changes) and added a changeset withpnpm changeset add