cli: [Bug]: `theme dev` randomly stopping itself

Please confirm that you have:

  • Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
  • Reproduced the issue in the latest CLI version.

In which of these areas are you experiencing a problem?

Theme

Expected behavior

theme dev should only stop if requested.

Actual behavior

theme dev seems to randomly stop itself at random times.

Stack trace

No response

Reproduction steps

  1. run theme dev
  2. open dev theme editor and make some changes
  3. after a random amount of time, cli will have stopped itself in terminal

Operating System

Mac OS Ventura 13.0

Shopify CLI version (check your project’s package.json if you’re not sure)

3.21.0

Shell

$bash

Node version (run node -v if you’re not sure)

v18.11.0

What language and version are you using in your application?

Shopify liquid template language

https://github.com/Shopify/cli/issues/728#tasklist-block-18d54d4f-3bb8-43e0-9890-c02ea94ebf71

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 52 (13 by maintainers)

Most upvoted comments

That was very helpful indeed! And some more good news, we decided to do a patch release now, so version 3.31.1 should already be available 😃

This PR should fix it https://github.com/Shopify/cli/pull/1013 We’ll release a new version on monday 👍

Thanks for the report @vfonic , i’ll look into this during this week 😃

There a timeset called ThemeRefreshTimeoutInMinutes in the Shopify auth using the CLI to authenticate to a store, its 90 minutes, this really need to change as soon as possible or add the --password flag to use the token generated by the theme Access App.

Check here: https://github.com/Shopify/cli/blob/main/packages/theme/src/cli/commands/theme/dev.ts

Closing this issue as this bug was fixed on version 3.29.0, @its-anas could you check that you have the latest version of the CLI? Apart from authentication no longer stopping the dev server, you can now use the --password flag for dev too.

Does this happen all the time or you just didn’t restart your computer in days? Let’s focus on fixing a Shopify CLI bug if it’s something that’s a Shopify CLI bug. Maybe you just ran shopify theme dev too many times (or the process got restarted too many times itself)? It seems like you have several processes. Maybe fkill killed the one that was active/established and then the next ruby process took over the port.

So:

  1. Check if fkill changes the output of lsof
  2. Restart your computer

If after these two you still have issues, then it might be Shopify CLI issue.

Note to Shopify: I’m writing this probably for the fifth time by now: Please stop reinventing the wheel every time a new language comes around. Next time you come up with the idea how incredible it would be to have Shopify CLI reimplemented in WASM…just don’t. https://github.com/Shopify/shopify-cli/issues/2090#issuecomment-1056141668 @charlespwd you promised me there won’t be any more reinventing the wheel… /cc @isaacroldan Please stop doing this every year.

ThemeKit => Slate => some unofficial Gulp.js tools => Slate beta => Shopify CLI gem v0 + ThemeKit => Some stuff in Go => Shopify CLI v1 => Shopify CLI v2 => Shopify CLI v3 => Shopify CLI v4 (yes, there was a massive change between every one of these CLI versions)

Unfortunately we can’t know when the process is killed (we’d need to poll for that), and i’m not sure that polling would be reliable on all platforms.

You could even try (re)starting the process several times if it fails on the first try.

This won’t work on all platforms, for instance on Windows it doesn’t fail, it just starts multiple processes even if the port is not free.

You could also update the auth token in-place, instead of having to restart the process.

This is the plan, the current implementation is temporary until we can do this. But this won’t be possible until the core logic for this is migrated to node. We are actively working on this, but can’t promise any dates.

@isaacroldan I, too, have the same issue – times out and then I get an error when trying to save/sync a file: ERROR » update assets/base.css: ✗ Please login again with shopify login

I’m on CLI v 3.30.2

(as a side note, it says to login again with “shopify login” but using that command gives the error command login not found)