Fix the shopify theme dev
/shopify theme console
proxy to handle cookies as expected
#3851
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?
Fixed the
shopify theme dev
/shopify theme console
proxy to handle cookies as expected, and ensured they no longer render the live theme instead of the development theme.WHAT is this pull request doing?
With the session cookie being renamed, the CLI needed to follow that change [1] [2]. However, the new regular expression captures the
;
, which was creating a scenario like this:This is not an issue when the session cookie is the last one in the cookie string, but when it's in the middle of the string, it depends on the client's fallback behavior, which creates an intermittent behavior.
The browser sometimes is able to infer the cookie correctly, but in scenarios like when the
--password
flag is passed, where we have the Theme Access app in the middle, the proxy was consistently failing on passing the cookie. Now, we're always appending the;
even when the trailing semicolon is supported.This PR also removes the
storefront_session.nil?
from theauth_middleware.rb
, which is related to the behavior of rendering the live theme in the context ofshopify theme console
. Removing this is important because stores that are not password protected don't have that cookie.How to test your changes?
shopify theme dev
To test this change in the
shopify theme dev
command, you may run it with the--password
flag, or reduce the expiration date on the proxy (to force the cookie update) as the video shows:shopify theme console
To test this change in the
shopify theme console
command, you may run the command on a store that is not password-protected:Post-release steps
None.
Measuring impact
How do we know this change was effective? Please choose one:
Checklist
dev
ordeploy
have been reflected in the internal flowchart.