cli icon indicating copy to clipboard operation
cli copied to clipboard

[Bug]: got error: invalid_target

Open zmzimpl opened this issue 1 year ago โ€ข 5 comments

Please confirm that you have:

  • [X] 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.)
  • [X] Reproduced the issue in the latest CLI version.

In which of these areas are you experiencing a problem?

Theme

Expected behavior

success login into

Actual behavior

got error: invalid_target image

Verbose output

E:\dev\shopify\themes>shopify theme pull --store xxxxx.myshopify.com --verbose
2024-06-06T08:20:13.867Z: Running command theme pull
2024-06-06T08:20:13.878Z: Ensuring that the user is authenticated with the Theme API with the following scopes:
[]

2024-06-06T08:20:13.879Z: Ensuring that the user is authenticated with the Admin API with the following scopes for the store xxxxx.myshopify.com:
[]

2024-06-06T08:20:13.880Z: Getting session store...
2024-06-06T08:20:13.880Z: Validating existing session against the scopes:
[
  "openid",
  "https://api.shopify.com/auth/shop.admin.graphql",
  "https://api.shopify.com/auth/shop.admin.themes",
  "https://api.shopify.com/auth/partners.collaborator-relationships.readonly",
  "https://api.shopify.com/auth/shop.storefront-renderer.devtools",
  "https://api.shopify.com/auth/partners.app.cli.access",
  "https://api.shopify.com/auth/destinations.readonly"
]
For applications:
{
  "adminApi": {
    "scopes": [],
    "storeFqdn": "xxxxx.myshopify.com"
  }
}

2024-06-06T08:20:13.880Z: Initiating the full authentication flow...
2024-06-06T08:20:13.881Z: Authorizing through Identity's website...

To run this command, log in to Shopify.
๐Ÿ‘‰ Press any key to open the login page on your browser
2024-06-06T08:20:28.382Z: Reading the content of file at C:/Users/Administrator/AppData/Roaming/nvm/v18.18.2/node_modules/@shopify/cli/dist/assets/success.html...
2024-06-06T08:20:28.406Z: Reading the content of file at C:/Users/Administrator/AppData/Roaming/nvm/v18.18.2/node_modules/@shopify/cli/dist/assets/style.css...
2024-06-06T08:20:28.886Z: Authorization code received. Exchanging it for a CLI token...
2024-06-06T08:20:28.887Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=authorization_code&code=TUV4bmNNcTcyb3RPQ1J2cHEyVXU3ZGV0YjFFMWVuekczQ2V5UTZTMnduODQvbTNhZDBjY1hVSkxjejR5ZkhKYVlRUDM4SjR2NkRTSXRNdjRSR2JPUG5aSTV6R2Q4bDRSeE13K2hjaGI1bFdmV2RBd1FoK0N0MUtqWXRDSUEzM0VVbWJzaDVhbGhjNFpnUkNKNGFiR2xsbDBFS3ZJYVI5bkNSVzdZYUVtNjdHWjFTYmNMdDNVSEFrOWtibVk0SHU5V25lSElQN09melVzYmtLaGJDSTRLOHpSdFFFdHRQa1dvTUNvejV3MWlhYWpNeHhjeUpJRGFPbTZmK04xOUcrbXdoZG1yVW1OdnBlTUp2b082VUhzN3BCUEw3UjhGMS9JcU95Q3U0Uk4rcHNZRnZNZEFQaTJFY3pRSi96TkVpRDFaZFdiM0N6TmZRPT0tLUhMd1hRMjlScUtwTXd0NDctLXJiSjM3eFYvcUYxQmtMWlN6eXBQUlE9PQ&redirect_uri=http%3A%2F%2F127.0.0.1%3A3456&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&code_verifier=vEUzN8vCkVy7NXzWrbt9HwJD7ffLFX7MDQHK8xSNrNg
With request headers:
 - User-Agent: Shopify CLI; v=3.60.1
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: win32
 - Content-Type: application/json

2024-06-06T08:20:29.851Z: Request to https://accounts.shopify.com/oauth/token?grant_type=authorization_code&code=TUV4bmNNcTcyb3RPQ1J2cHEyVXU3ZGV0YjFFMWVuekczQ2V5UTZTMnduODQvbTNhZDBjY1hVSkxjejR5ZkhKYVlRUDM4SjR2NkRTSXRNdjRSR2JPUG5aSTV6R2Q4bDRSeE13K2hjaGI1bFdmV2RBd1FoK0N0MUtqWXRDSUEzM0VVbWJzaDVhbGhjNFpnUkNKNGFiR2xsbDBFS3ZJYVI5bkNSVzdZYUVtNjdHWjFTYmNMdDNVSEFrOWtibVk0SHU5V25lSElQN09melVzYmtLaGJDSTRLOHpSdFFFdHRQa1dvTUNvejV3MWlhYWpNeHhjeUpJRGFPbTZmK04xOUcrbXdoZG1yVW1OdnBlTUp2b082VUhzN3BCUEw3UjhGMS9JcU95Q3U0Uk4rcHNZRnZNZEFQaTJFY3pRSi96TkVpRDFaZFdiM0N6TmZRPT0tLUhMd1hRMjlScUtwTXd0NDctLXJiSjM3eFYvcUYxQmtMWlN6eXBQUlE9PQ&redirect_uri=http%3A%2F%2F127.0.0.1%3A3456&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&code_verifier=vEUzN8vCkVy7NXzWrbt9HwJD7ffLFX7MDQHK8xSNrNg completed in 960 ms
With response headers:
 - cache-control: no-cache, no-store, private, must-revalidate, max-age=0
 - content-type: application/json; charset=utf-8
 - etag: W/"32d9e7dfb5de8aa6d6f32a9758b325e5"
 - x-request-id: 48c072a0-28d0-4236-8889-dd840eac8a20-1717662034

2024-06-06T08:20:29.854Z: CLI token received. Exchanging it for application tokens...
2024-06-06T08:20:29.855Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=271e16d403dfa18082ffb3d197bd2b5f4479c3fc32736d69296829cbb28d41a6&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.app.cli.access&subject_token=****
With request headers:
 - User-Agent: Shopify CLI; v=3.60.1
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: win32
 - Content-Type: application/json

2024-06-06T08:20:29.855Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=ee139b3d-5861-4d45-b387-1bc3ada7811c&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.storefront-renderer.devtools&subject_token=****
With request headers:
 - User-Agent: Shopify CLI; v=3.60.1
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: win32
 - Content-Type: application/json

2024-06-06T08:20:29.855Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=32ff8ee5-82b8-4d93-9f8a-c6997cefb7dc&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fdestinations.readonly&subject_token=****
With request headers:
 - User-Agent: Shopify CLI; v=3.60.1
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: win32
 - Content-Type: application/json

2024-06-06T08:20:29.855Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=7ee65a63608843c577db8b23c4d7316ea0a01bd2f7594f8a9c06ea668c1b775c&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.admin.graphql+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.admin.themes+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.collaborator-relationships.readonly&subject_token=****&destination=https%3A%2F%2Fxxxxx.myshopify.com%2Fadmin
With request headers:
 - User-Agent: Shopify CLI; v=3.60.1
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: win32
 - Content-Type: application/json

2024-06-06T08:20:30.753Z: Request to https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=7ee65a63608843c577db8b23c4d7316ea0a01bd2f7594f8a9c06ea668c1b775c&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.admin.graphql+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.admin.themes+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.collaborator-relationships.readonly&subject_token=****&destination=https%3A%2F%2Fxxxxx.myshopify.com%2Fadmin completed in 895 ms
With response headers:
 - cache-control: no-cache, no-store, private, must-revalidate, max-age=0
 - content-type: application/json; charset=utf-8
 - x-request-id: 5c8a0f3e-b62a-43d1-85b9-7ece1426989c-1717662035

โ•ญโ”€ error โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚                                                                                        โ”‚
โ”‚  invalid_target                                                                        โ”‚
โ”‚                                                                                        โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

2024-06-06T08:20:30.780Z: Request to https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=ee139b3d-5861-4d45-b387-1bc3ada7811c&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.storefront-renderer.devtools&subject_token=**** completed in 924 ms
With response headers:
 - cache-control: no-cache, no-store, private, must-revalidate, max-age=0
 - content-type: application/json; charset=utf-8
 - etag: W/"72953fcb223cff6bf40aa84594c0c795"
 - x-request-id: 5fd7d1a3-76d5-4783-9ac0-cfff78c5f9b1-1717662035

2024-06-06T08:20:30.795Z:
Running system process:
  ยท Command: ruby -v
  ยท Working directory: E:/dev/shopify/themes

2024-06-06T08:20:30.804Z: Request to https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=271e16d403dfa18082ffb3d197bd2b5f4479c3fc32736d69296829cbb28d41a6&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.app.cli.access&subject_token=**** completed in 948 ms
With response headers:
 - cache-control: no-cache, no-store, private, must-revalidate, max-age=0
 - content-type: application/json; charset=utf-8
 - etag: W/"0c276e602648b9c6e7109aec109c780f"
 - x-request-id: c59ce262-1632-4e76-94b7-42695f6880cc-1717662035

2024-06-06T08:20:30.828Z: Request to https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=32ff8ee5-82b8-4d93-9f8a-c6997cefb7dc&scope=https%3A%2F%2Fapi.shopify.com%2Fauth%2Fdestinations.readonly&subject_token=**** completed in 971 ms
With response headers:
 - cache-control: no-cache, no-store, private, must-revalidate, max-age=0
 - content-type: application/json; charset=utf-8
 - etag: W/"c6380df57905810f6389db490e560c00"
 - x-request-id: 3a4bbbdf-73ea-446f-b05a-934d49dbd64e-1717662035

2024-06-06T08:20:31.641Z: Request to https://monorail-edge.shopifysvc.com/v1/produce completed in 835 ms
With response headers:
 - x-request-id: fdedd840-b965-4946-a528-71e30beb744a

2024-06-06T08:20:31.642Z: Analytics event sent: {
  "command": "theme pull",
  "time_start": 1717662013868,
  "time_end": 1717662030772,
  "total_time": 16904,
  "success": false,
  "cli_version": "3.60.1",
  "ruby_version": "3.3.2",
  "node_version": "18.18.2",
  "is_employee": false,
  "uname": "windows amd64",
  "env_ci": false,
  "env_plugin_installed_any_custom": false,
  "env_plugin_installed_shopify": "[\"@shopify/cli\"]",
  "env_shell": "cmd.exe",
  "env_device_id": "2710bf244ea79f9ffbf7959ec5cc5dbd905cae88",
  "env_cloud": "localhost",
  "env_package_manager": "unknown",
  "env_is_global": true,
  "cmd_app_warning_api_key_deprecation_displayed": false,
  "cmd_all_timing_network_ms": 1889,
  "cmd_all_timing_prompts_ms": 14979,
  "cmd_all_launcher": "unknown",
  "cmd_all_topic": "theme",
  "cmd_all_plugin": "@shopify/cli",
  "cmd_all_force": false,
  "cmd_all_verbose": true,
  "cmd_all_path_override": true,
  "cmd_all_path_override_hash": "00aaf2c242c5fd7060f79c5ece3116f2b72be299",
  "cmd_all_timing_active_ms": 34,
  "cmd_all_exit": "expected_error",
  "args": "--store xxxxx.myshopify.com --verbose",
  "error_message": "invalid_target",
  "env_plugin_installed_all": "[\"@shopify/cli\"]",
  "metadata": "{\"extraPublic\":{},\"extraSensitive\":{}}"
}
2024-06-06T08:20:31.648Z: Reporting handled error to Bugsnag: invalid_target

Reproduction steps

  1. run command: shopify theme pull --store xxxxx.myshopify.com
  2. got error: invalid_target

Operating System

Windows 11

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

3.60.1

Shell

cmd

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

v18.18.2

What language and version are you using in your application?

No response

zmzimpl avatar Jun 06 '24 08:06 zmzimpl

๐Ÿ‘‹ thanks for reporting this issue, this usually happens when the shopify store name is malformed. the command you shared typically would work on mac or linux, but im wondering if windows is not parsing the command correctly. have you been able to use any other CLI command with this store domain exactly as youve typed it?

mgmanzella avatar Jun 19 '24 14:06 mgmanzella

some other things you can try as well to confirm what we think is happening true:

  • does running shopify theme pull prompt you with a list of themes to choose from ? (it should use your most recent store you authenticated and used a command with)
  • does using an environment variable for the store SHOPIFY_FLAG_STORE return different behavior?
  • if you have multiple stores, does using a different storename still return invalid target?

mgmanzella avatar Jun 19 '24 14:06 mgmanzella

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. โ†’ If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.

P.S. You can learn more about why we stale issues here.

github-actions[bot] avatar Aug 01 '24 03:08 github-actions[bot]

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. โ†’ If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.

P.S. You can learn more about why we stale issues here.

github-actions[bot] avatar Sep 13 '24 03:09 github-actions[bot]

Hi @zmzimpl ๐Ÿ‘‹

We've deployed an improvement to the error messaging here, to make it more clear that the store name or ID is likely incorrect. It will be available on the next minor CLI version release.

If you've confirmed that you have the correct store name/ID, and you've reviewed the steps in @mgmanzella's comments above, let us know.

itsjustriley avatar Sep 17 '24 16:09 itsjustriley

Hi @zmzimpl, I'm unable to reproduce this. Could you try again on the latest version of the CLI?

blittle avatar Oct 23 '24 16:10 blittle

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. โ†’ If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.

P.S. You can learn more about why we stale issues here.

github-actions[bot] avatar Jan 17 '25 03:01 github-actions[bot]