Repository: Shopify/shopify-cli

Issue #1694: Shopify auth servers incorrectly reporting 403.
Created: 2021-10-27T18:55:46Z
Issue summary
Attempting to run theme commands is rejected due to authorization errors.
Expected behavior
Executing shopify theme pull should simply pull the theme.
Actual behavior

Following the stack the issue is during the API requests to the Shopify servers.
This seems to be somewhat intermittent and seems to be Shopify store dependent from time-to-time.
Our team has only been experiencing the issue since the 25th of October
Switching to a different store is working, and I can execute theme commands on most other stores
Different team members are having issues for different stores, e.g. I could authenticate with store-a but my colleague couldn't, however, I cannot authenticate with store-b yet my colleague can. And we can both authenticate with store-c.
Full cache clearing, cookie clearing, logout and re-login does not solve the problem.
I can confirm that the access token is being regenerated within the CLI each time I login/logout, yet still am not authorized

See error screenshots;


Steps to reproduce the problem
Exact steps are a bit uncertain since it's so sporadic

Logout from CLI if logged in
Log in using a staff admin account to a development store
Execute any theme command, typically shopify theme pull or shopify theme push
Chance of receiving an authentication issue despite having authenticated

Specifications

App type: Shopify CLI, Theme commands
Operating System: Windows 10 Home 10.1.1903, other team members are running some form of Mac OS
Shell: Powershell, Term on Mac
Ruby version (ruby -v): ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x64-mingw32]
Shopify CLI version: 2.6.5, also have tried a few older versions to no avail

Additional Information

I can confirm that the login I am using is the staff account, not the partner account. If it's a potential issue they are the same email but I am using the Single-Sign-On account
shopify whoami is correctly reporting my access prior to running theme commands.
Tonnes of testing has lead me to believe that partner accounts seem to always work on production/non-development stores, and staff accounts seem to always work on development stores.

Duplicate issue #2119: [Bug]: Cannot perform theme operation in shopify-cli 403 permission denied. Shopify Ticket # 29251522
Created: 2022-03-04T10:08:04Z
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.

What type of project are you working on?
theme
Expected behavior
I would be able to push pull and serve themes to and from my local machine.
Windows 10 fresh install
➜ shopify version
2.13.0
➜ ruby -v
ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x64-mingw32]
Actual behavior
$env:SHOPIFY_CLI_STACKTRACE=1
➜ shopify theme pull
X An unexpected error occured.
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/shopify_cli/api.rb:74:in `block in request': 403 (ShopifyCLI::API::APIRequestForbiddenError)
{"errors":"Unauthorized Access"}
Stack trace
Traceback (most recent call last):
        43: from C:/Ruby27-x64/bin/shopify:23:in `<main>'
        42: from C:/Ruby27-x64/bin/shopify:23:in `load'
        41: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/bin/shopify:59:in `<top (required)>'
        40: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/bin/shopify:49:in `block in <top (required)>'
        39: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb:21:in `call'
        38: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb:75:in `handle_abort'
        37: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/bin/shopify:50:in `block (2 levels) in <top (required)>'
        36: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/shopify_cli/core/entry_point.rb:23:in `call'
        35: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/shopify_cli/core/monorail.rb:30:in `log'
        34: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/shopify_cli/core/entry_point.rb:24:in `block in call'
        33: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/shopify_cli/core/executor.rb:15:in `call'
        32: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:43:in `with_traps'
        31: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:51:in `twrap'
        30: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:44:in `block in with_traps'
        29: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:51:in `twrap'
        28: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:45:in `block (2 levels) in with_traps'
        27: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/shopify_cli/core/executor.rb:16:in `block in call'
        26: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:35:in `with_logging'
        25: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/vendor/deps/cli-ui/lib/cli/ui.rb:176:in `log_output_to'
        24: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:36:in `block in with_logging'
        23: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/vendor/deps/cli-ui/lib/cli/ui/stdout_router.rb:169:in `with_id'
        22: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:37:in `block (2 levels) in with_logging'
        21: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/shopify_cli/core/executor.rb:17:in `block (2 levels) in call'
        20: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/shopify_cli/command.rb:27:in `call'
        19: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/shopify_cli/command/sub_command.rb:16:in `call'
        18: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/project_types/theme/commands/pull.rb:40:in `call'
        17: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/project_types/theme/commands/pull.rb:89:in `find_theme'
        16: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/project_types/theme/commands/pull.rb:93:in `select_theme'
        15: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/shopify_cli/form.rb:13:in `ask'
        14: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/project_types/theme/forms/select.rb:12:in `ask'
        13: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/vendor/deps/cli-ui/lib/cli/ui/prompt.rb:100:in `ask'
        12: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/vendor/deps/cli-ui/lib/cli/ui/prompt.rb:188:in `ask_interactive'
        11: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/project_types/theme/forms/select.rb:13:in `block in ask'
        10: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/project_types/theme/forms/select.rb:27:in `theme_presenters'
         9: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/project_types/theme/presenters/themes_presenter.rb:16:in `all'
         8: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/project_types/theme/presenters/themes_presenter.rb:28:in `all_themes'
         7: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/shopify_cli/theme/theme.rb:167:in `all'
         6: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/shopify_cli/theme/theme.rb:208:in `fetch_themes'
         5: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/shopify_cli/admin_api.rb:95:in `rest_request'
         4: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/util.rb:172:in `retry_after'
         3: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/shopify_cli/admin_api.rb:92:in `block in rest_request'
         2: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/shopify_cli/api.rb:89:in `request'
         1: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/util.rb:172:in `retry_after'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/shopify-cli-2.13.0/lib/shopify_cli/api.rb:74:in `block in request': 403 (ShopifyCLI::API::APIRequestForbiddenError)
{"errors":"Unauthorized Access"}
Reproduction steps
1.shopify login --store lynn-dev-1
2.shopify theme pull
3.
Operating System
Windows 10 Pro
CLI version (run shopify version if you're not sure)
2.13
Shell
powershell
Ruby version (run ruby -v if you're not sure)
No response
What language and version are you using in your application?
ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x64-mingw32]

Closing comment (2022-03-16T11:28:51Z): Possibly related to #1694