Shopify / cli

Build apps, themes, and hydrogen storefronts for Shopify
https://shopify.dev
MIT License
436 stars 128 forks source link

[Bug]: `shopify app deploy` still asking for prompt even though --force flag is specified #4568

Closed FrankHeijden closed 3 weeks ago

FrankHeijden commented 1 month ago

Please confirm that you have:

In which of these areas are you experiencing a problem?

App

Expected behavior

It should not prompt for extenson migration if force flag is specified.

Actual behavior

It tried to prompt, and error out:

╭─ info ───────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  Extension migrations can't be undone.                                       │
│                                                                              │
│  Your "X" configuration has been updated. Migrating gives you       │
│  access to new features and won't impact the end user experience. All        │
│  previous extension versions will reflect this change.                       │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ error ──────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  Failed to prompt:                                                           │
│                                                                              │
│  Migrate "X"?                                                          │
│                                                                              │
│  This usually happens when running a command non-interactively, for example  │
│   in a CI environment, or when piping to or from another process.            │
│                                                                              │
│  To resolve this, specify the option in the command, or run the command in   │
│  an interactive environment such as your local terminal.                     │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯

Verbose output

-

Reproduction steps

-

Operating System

Github Actions x86 runners

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

3.68.0

Shell

No response

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

No response

What language and version are you using in your application?

No response

isaacroldan commented 1 month ago

Hi @FrankHeijden , i'm afraid that migrations need to be manually accepted, so --force won't have any effect here. Extension migrations are a one-time thing, so once done, --force will work as normal. I'll bring this to the team in case we want to revisit this behaviour.

FrankHeijden commented 1 month ago

Thanks @isaacroldan ! Makes sense -- might just be an us problem here since we use multiple Shopify Apps as "environments", so by the time it reaches the production app deployment via CI/CD, we already are very sure that we're doing the migration, and want it to be accepted automatically.

I guess it would be nice to have all these migrations/interactive questions be skipped with the --force flag, but not impossible to manage.

I do however have a similar related issue for functions, when one changes the name of the function, a similar prompt appears where Shopify will try to match the name defined locally against the name defined in Partners, and asks if the mapping is correct. It seems that after this prompt, it somehow only stores this name-mapping locally, and doesn't actually change the function name in Shopify Partners, causing this prompt to be asked every time after a rename of a function (breaking CI/CD for all runs after a rename).

isaacroldan commented 4 weeks ago

Hi @FrankHeijden!

That is correct, the mapping is stored locally in the .env files of your project. If you track those in git, then all instances of the CLI will get the correct matching and you'd only need to do it once.

isaacroldan commented 3 weeks ago

I'll close this issue, but please feel free to post any other question and we can reopen it :)