Shopify / cli

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

[Bug]: first pull very slow #3437

Closed dzschille closed 7 months ago

dzschille commented 9 months ago

Please confirm that you have:

In which of these areas are you experiencing a problem?

Theme

Expected behavior

If i run theme pull for the first time to download a theme in an empty directory it should download all theme files in a few seconds.

Actual behavior

If i run theme pull for the first time to download a theme in an empty directory it needs minutes (often more than 10) to download all theme files.

Also the cmd_all_timing_active_ms value is around half the real time it needed to download the theme.

See the verbose output where i downloaded a fresh installed Dawn theme what needed 11 minutes. The size of all theme files are just 5,2 MB, my internet connection is 1Gbit/s.

Verbose output

shopify theme pull --store=shpfy-cli-test.myshopify.com --verbose
2024-02-14T14:00:08.539Z: Running command theme pull
  shopify:theme:pull init version: @oclif/core@3.15.1 argv: [ '--store=shpfy-cli-test.myshopify.com', '--verbose' ] +0ms
2024-02-14T14:00:08.567Z: Ensuring that the user is authenticated with the Theme API with the following scopes:
[]

2024-02-14T14:00:08.568Z: Ensuring that the user is authenticated with the Admin API with the following scopes for the store shpfy-cli-test.myshopify.com:
[]

2024-02-14T14:00:08.568Z: Getting session store...
2024-02-14T14:00:08.571Z: 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": "shpfy-cli-test.myshopify.com"
  }
}

2024-02-14T14:00:08.571Z: Sending Identity Introspection request to URL: https://accounts.shopify.com/oauth/introspection
2024-02-14T14:00:08.571Z: Sending POST request to URL https://accounts.shopify.com/oauth/introspection
With request headers:
 - User-Agent: Shopify CLI; v=3.56.0
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: linux
 - Content-Type: application/json

2024-02-14T14:00:08.845Z: Request to https://accounts.shopify.com/oauth/introspection completed in 263 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/"90d3e38811a49704e414d917b674357f"
 - x-request-id: da3d42bc-a5ff-434e-8632-8284c288b2e3

2024-02-14T14:00:08.847Z: The identity token is valid: true
2024-02-14T14:00:08.847Z: 
The validation of the token for application/identity completed with the following results:
- It's expired: true
- It's invalid in identity: false

2024-02-14T14:00:08.847Z: The current session is valid but needs refresh. Refreshing...
2024-02-14T14:00:08.848Z: Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=refresh_token&access_token=atkn_CjQIwf-yrgYQ4bezrgZSJggBEhAN-kGpxsxKCLdhmXBRDD1MGhDyFFKS6_pLupUH19g3t9tnEkASMmUo1HANYhPNiG0yfkfE9gH49m8XYdNtvWWLAHttkbDoy688w6S6Elxf9cGSphgTtaUUkrskgnygNtK9MhcN&refresh_token=atkn_CiEIwf-yrgYQwZnRrwaiARIKEPIUUpLr-ku6lQfX2De322cSQFWkR7v43htcPA4b_pEU3KViwPSSUuh5qdAFvIqY80PRBetAdME5iLBjPSC7LP7fInj5LQw26-hA7-b3yV_5Kws&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3
With request headers:
 - User-Agent: Shopify CLI; v=3.56.0
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: linux
 - Content-Type: application/json

2024-02-14T14:00:09.167Z: Request to https://accounts.shopify.com/oauth/token?grant_type=refresh_token&access_token=atkn_CjQIwf-yrgYQ4bezrgZSJggBEhAN-kGpxsxKCLdhmXBRDD1MGhDyFFKS6_pLupUH19g3t9tnEkASMmUo1HANYhPNiG0yfkfE9gH49m8XYdNtvWWLAHttkbDoy688w6S6Elxf9cGSphgTtaUUkrskgnygNtK9MhcN&refresh_token=atkn_CiEIwf-yrgYQwZnRrwaiARIKEPIUUpLr-ku6lQfX2De322cSQFWkR7v43htcPA4b_pEU3KViwPSSUuh5qdAFvIqY80PRBetAdME5iLBjPSC7LP7fInj5LQw26-hA7-b3yV_5Kws&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3 completed in 318 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/"e448c0de6f4a84cea57f47a8ad0e9364"
 - x-request-id: 861b32db-5518-4f45-95c0-13eb966ccaa5

2024-02-14T14:00:09.168Z: 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.56.0
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: linux
 - Content-Type: application/json

2024-02-14T14:00:09.168Z: 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.56.0
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: linux
 - Content-Type: application/json

2024-02-14T14:00:09.168Z: 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.56.0
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: linux
 - Content-Type: application/json

2024-02-14T14:00:09.168Z: 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%2Fshpfy-cli-test.myshopify.com%2Fadmin
With request headers:
 - User-Agent: Shopify CLI; v=3.56.0
 - Keep-Alive: timeout=30
 - Sec-CH-UA-PLATFORM: linux
 - Content-Type: application/json

2024-02-14T14:00:09.415Z: 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 245 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/"038b48a5b894351bb6d84f52b149c77b"
 - x-request-id: 49bb2ae0-7938-47f1-9c50-708f65d45f4d

2024-02-14T14:00:09.428Z: 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 258 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/"d5e59774b705d1f89f22a90e0ffb28ec"
 - x-request-id: 6c19c3fe-55c6-4036-8aa9-610d1a4762d1

2024-02-14T14:00:09.446Z: 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 276 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/"e904f580a7c5e61488292ce2f1ebcb60"
 - x-request-id: 175de0af-c97c-4950-828e-43b65079d6d8

2024-02-14T14:00:09.448Z: 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%2Fshpfy-cli-test.myshopify.com%2Fadmin completed in 277 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/"37bcc3b44fb863f97ec446318e18ad15"
 - x-request-id: 5da11264-67a1-41e2-b58a-815cf0504990

2024-02-14T14:00:09.449Z: Setting session store...
2024-02-14T14:00:09.466Z: Getting development theme...
2024-02-14T14:00:09.476Z: 
Running system process:
  · Command: /home/linuxbrew/.linuxbrew/opt/ruby/bin/ruby -v
  · Working directory: /home/david/repos/shopify-cli-v3-test

2024-02-14T14:00:09.493Z: 
Running system process:
  · Command: /home/linuxbrew/.linuxbrew/opt/ruby/bin/bundle -v
  · Working directory: /home/david/repos/shopify-cli-v3-test

2024-02-14T14:00:09.610Z: Reading the content of file at /home/linuxbrew/.linuxbrew/Cellar/shopify-cli/3.56.0/libexec/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/Gemfile...
2024-02-14T14:00:09.614Z: 
Running system process:
  · Command: /home/linuxbrew/.linuxbrew/opt/ruby/bin/bundle install
  · Working directory: /home/linuxbrew/.linuxbrew/Cellar/shopify-cli/3.56.0/libexec/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby

2024-02-14T14:00:09.835Z: 
Running system process:
  · Command: /home/linuxbrew/.linuxbrew/opt/ruby/bin/bundle exec /home/linuxbrew/.linuxbrew/opt/ruby/bin/ruby /home/linuxbrew/.linuxbrew/Cellar/shopify-cli/3.56.0/libexec/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/bin/shopify theme pull /home/david/repos/shopify-cli-v3-test
  · Working directory: /home/david/repos/shopify-cli-v3-test

/home/linuxbrew/.linuxbrew/Cellar/shopify-cli/3.56.0/libexec/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/bin/shopify:15: warning: webrick was loaded from the standard library, but is not part of the default gems since Ruby 3.0.0. Add webrick to your Gemfile or gemspec.
/home/linuxbrew/.linuxbrew/Cellar/shopify-cli/3.56.0/libexec/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/bin/shopify:15: warning: base64 was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add base64 to your Gemfile or gemspec.
DEBUG GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes.json with request_id: a5e2718b-ba07-4cfe-9f71-30b4be9c19d1
? Select a theme to pull from shpfy-cli-test.myshopify.com (You chose: Dawn [live])
┏━━ Pulling theme files from Dawn (#133896143043) on shpfy-cli-test.myshopify.com ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
┃ DEBUG GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json with request_id: e6d8e044-30f0-43c6-a6d2-7cb25f04980e
┃ DEBUG get assets/constants.js
┃ DEBUG get assets/section-main-product.css
┃ DEBUG GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json?asset%5Bkey%5D=assets%2Fsection-main-product.css with request_id: c8a3b370-f06e-4f75-8019-c31596051221
┃ DEBUG get assets/component-accordion.css
┃ DEBUG GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json?asset%5Bkey%5D=assets%2Fconstants.js with request_id: 0719fb04-8444-4df7-a970-bb8546d4921d 0%  
┃ ...
...
...
┃ DEBUG timeout in GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json?asset%5Bkey%5D=templates%2Fcart.json                                            99% 
┃ DEBUG GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json?asset%5Bkey%5D=templates%2Fcart.json with request_id: 731c1f11-6dc6-408a-b866-715641e290b0
┃                                                                                                                                                                                              100%
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ (664.65s) ━━
✓ Theme pulled successfully.
2024-02-14T14:11:16.851Z: 
Running system process:
  · Command: /home/linuxbrew/.linuxbrew/opt/ruby/bin/ruby -v
  · Working directory: /home/david/repos/shopify-cli-v3-test

2024-02-14T14:11:17.057Z: Request to https://monorail-edge.shopifysvc.com/v1/produce completed in 192 ms
With response headers:
 - x-request-id: 2106d088-5e9e-440f-8e01-a997a90a3d86

2024-02-14T14:11:17.058Z: Analytics event sent: {
  "command": "theme pull",
  "time_start": 1707919208540,
  "time_end": 1707919876841,
  "total_time": 668301,
  "success": true,
  "cli_version": "3.56.0",
  "ruby_version": "3.3.0",
  "node_version": "21.6.1",
  "is_employee": false,
  "uname": "linux amd64",
  "env_ci": false,
  "env_plugin_installed_any_custom": false,
  "env_plugin_installed_shopify": "[\"@shopify/cli\",\"@shopify/plugin-did-you-mean\",\"@shopify/theme\"]",
  "env_shell": "zsh",
  "env_device_id": "1019fba5751f42ca3e0240a5b3b2c92a06c0fc5c",
  "env_cloud": "localhost",
  "env_package_manager": "unknown",
  "cmd_all_timing_network_ms": 0,
  "cmd_all_timing_prompts_ms": 0,
  "cmd_all_launcher": "unknown",
  "cmd_all_topic": "theme",
  "cmd_all_plugin": "@shopify/theme",
  "cmd_all_force": false,
  "cmd_all_timing_active_ms": 668301,
  "cmd_all_exit": "ok",
  "args": "--store=shpfy-cli-test.myshopify.com --verbose",
  "env_plugin_installed_all": "[\"@shopify/cli\",\"@shopify/plugin-did-you-mean\",\"@shopify/theme\"]",
  "metadata": "{\"extraPublic\":{},\"extraSensitive\":{}}"
}
2024-02-14T14:11:17.058Z: Completed command theme pull

 ~/repos/shopify-cli-v3-test                                                                                                                                            

took 11m 10s  at 15:11:17

Reproduction steps

  1. Create a fresh developer store.
  2. Install the Dawn theme if it isn't already.
  3. Create an empty directory on your computer.
  4. Run shopify theme pull --store=your-test-store.myshopify.com

Operating System

Ubuntu 23.10

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

3.56.0

Shell

zsh

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

v21.1.0

What language and version are you using in your application?

No response

ekwoka commented 8 months ago

Here it looks like theres timeouts that are causing it to be slow, that you're losing connection. Is your connection ever unstable?

dzschille commented 8 months ago

Is your connection ever unstable?

Not that i am aware of. I just disabled my LAN connection to the cable modem and used wifi to connect to my mobile and downloaded the theme again in an empty directory:

┃ DEBUG get templates/page.json
┃ DEBUG GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json?asset%5Bkey%5D=templates%2Fpage.json with request_id: 45e0be65-235a-4db9-ab71-dc8533f51816 98% 
┃ DEBUG get sections/header-group.json
┃ DEBUG GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json?asset%5Bkey%5D=sections%2Fheader-group.json with request_id: 4f65c78f-b859-4f28-88a8-95557e8dce74
┃ DEBUG get sections/footer-group.json
┃ DEBUG GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json?asset%5Bkey%5D=sections%2Ffooter-group.json with request_id: df963d45-9f34-43f7-88c7-90c60f60c583
┃ DEBUG timeout in GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json?asset%5Bkey%5D=snippets%2Flanguage-localization.liquid                          99% 
┃ DEBUG GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json?asset%5Bkey%5D=snippets%2Flanguage-localization.liquid with request_id: 50a909f1-51c3-4bb1-bac5-0bd9b7393913
┃                                                                                                                                                                                              100%
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ (351.09s) ━━
✓ Theme pulled successfully.
2024-02-16T09:46:45.049Z: 
Running system process:
  · Command: /home/linuxbrew/.linuxbrew/opt/ruby/bin/ruby -v
  · Working directory: /home/david/repos/shopify-cli-v3-test

2024-02-16T09:46:45.618Z: Request to https://monorail-edge.shopifysvc.com/v1/produce completed in 554 ms
With response headers:
 - x-request-id: 763a23bd-1b16-4f77-a36f-27bef05ea057

2024-02-16T09:46:45.619Z: Analytics event sent: {
  "command": "theme pull",
  "time_start": 1708076446339,
  "time_end": 1708076805040,
  "total_time": 358701,
  "success": true,
  "cli_version": "3.56.0",
  "ruby_version": "3.3.0",
  "node_version": "21.6.1",
  "is_employee": false,
  "uname": "linux amd64",
  "env_ci": false,
  "env_plugin_installed_any_custom": false,
  "env_plugin_installed_shopify": "[\"@shopify/cli\",\"@shopify/plugin-did-you-mean\",\"@shopify/theme\"]",
  "env_shell": "zsh",
  "env_device_id": "1019fba5751f42ca3e0240a5b3b2c92a06c0fc5c",
  "env_cloud": "localhost",
  "env_package_manager": "unknown",
  "cmd_all_timing_network_ms": 0,
  "cmd_all_timing_prompts_ms": 0,
  "cmd_all_launcher": "unknown",
  "cmd_all_topic": "theme",
  "cmd_all_plugin": "@shopify/theme",
  "cmd_all_force": false,
  "cmd_all_timing_active_ms": 358701,
  "cmd_all_exit": "ok",
  "args": "--store=shpfy-cli-test.myshopify.com --verbose",
  "env_plugin_installed_all": "[\"@shopify/cli\",\"@shopify/plugin-did-you-mean\",\"@shopify/theme\"]",
  "metadata": "{\"extraPublic\":{},\"extraSensitive\":{}}"
}
2024-02-16T09:46:45.619Z: Completed command theme pull

 ~/repos/shopify-cli-v3-test          took 6m 1s  at 10:46:46 

It took just half of the time but still the same timeout messages. Than i switched back to cable and tried it again, needs double the time:

┃ DEBUG get sections/footer-group.json
┃ DEBUG GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json?asset%5Bkey%5D=sections%2Ffooter-group.json with request_id: 061ead66-362b-42fb-8d41-90f9144aecfa
┃ DEBUG timeout in GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json?asset%5Bkey%5D=templates%2Flist-collections.json                                99% 
┃ DEBUG GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json?asset%5Bkey%5D=templates%2Flist-collections.json with request_id: 0f023877-50e2-450d-b9ae-d880f35bdf54
┃                                                                                                                                                                                              100%
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ (736.46s) ━━
✓ Theme pulled successfully.
2024-02-16T10:00:57.043Z: 
Running system process:
  · Command: /home/linuxbrew/.linuxbrew/opt/ruby/bin/ruby -v
  · Working directory: /home/david/repos/shopify-cli-v3-test

2024-02-16T10:00:57.255Z: Request to https://monorail-edge.shopifysvc.com/v1/produce completed in 196 ms
With response headers:
 - x-request-id: 567b6c97-9f76-4c45-af16-b671ff485edc

2024-02-16T10:00:57.256Z: Analytics event sent: {
  "command": "theme pull",
  "time_start": 1708076917868,
  "time_end": 1708077657033,
  "total_time": 739165,
  "success": true,
  "cli_version": "3.56.0",
  "ruby_version": "3.3.0",
  "node_version": "21.6.1",
  "is_employee": false,
  "uname": "linux amd64",
  "env_ci": false,
  "env_plugin_installed_any_custom": false,
  "env_plugin_installed_shopify": "[\"@shopify/cli\",\"@shopify/plugin-did-you-mean\",\"@shopify/theme\"]",
  "env_shell": "zsh",
  "env_device_id": "1019fba5751f42ca3e0240a5b3b2c92a06c0fc5c",
  "env_cloud": "localhost",
  "env_package_manager": "unknown",
  "cmd_all_timing_network_ms": 0,
  "cmd_all_timing_prompts_ms": 0,
  "cmd_all_launcher": "unknown",
  "cmd_all_topic": "theme",
  "cmd_all_plugin": "@shopify/theme",
  "cmd_all_force": false,
  "cmd_all_timing_active_ms": 739165,
  "cmd_all_exit": "ok",
  "args": "--store=shpfy-cli-test.myshopify.com --verbose",
  "env_plugin_installed_all": "[\"@shopify/cli\",\"@shopify/plugin-did-you-mean\",\"@shopify/theme\"]",
  "metadata": "{\"extraPublic\":{},\"extraSensitive\":{}}"
}
2024-02-16T10:00:57.256Z: Completed command theme pull

 ~/repos/shopify-cli-v3-test              took 12m 21s  at 11:00:58 

However: both are to slow. Here i uploaded the theme to a small vServer:

> scp -r ./* ssh@myserver.com:/www/htdocs/test/
localization-form.js                                                                                                                                             100% 7694   197.7KB/s   00:00    
section-main-page.css                                                                                                                                            100%  305     8.1KB/s   00:00    
show-more.js                                                                                                                                                     100% 1208    32.3KB/s   00:00    
component-discounts.css                                                                                                                                          100%  562    14.6KB/s   00:00    
component-show-more.css                                                                                                                                          100%  162     4.3KB/s   00:00    
template-giftcard.css                                                                                                                                            100% 6820   150.2KB/s   00:00
... 
...
password.json                                                                                                                                                    100% 1108    29.2KB/s   00:00    
page.contact.json                                                                                                                                                100%  419    11.2KB/s   00:00    

 ~/repos/shopify-cli-v3-test                                          took 49s  at 11:04:13

Less than a minute. Download slightly faster:

> scp -r ssh@myserver.com:/www/htdocs/test/ .
...
                  took 46s  at 11:12:16

If i look for the way the the packets take through the internet to the shop i can see that Cloudflare is dropping packets:


> mtr shpfy-cli-test.myshopify.com --report -c 10
Start: 2024-02-16T11:22:21+0100
HOST: david-pc                     Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- fritz.box                  0.0%    10    0.6   0.9   0.6   1.1   0.2
  2.|-- ipxyz.static.kabel-d       0.0%    10    9.3  12.5   9.3  18.4   3.1
  3.|-- ipxyz.static.kabel-d       0.0%    10   12.2  11.9   9.2  17.0   2.6
  4.|-- 145.254.3.196              0.0%    10   29.4  14.1  10.2  29.4   5.6
  5.|-- 145.254.2.179              0.0%    10   17.0  22.2  16.3  37.7   7.7
  6.|-- 162.158.84.8              20.0%    10   20.2  29.4  19.8  80.8  21.1
  7.|-- 162.158.92.2               0.0%    10   31.0  26.3  16.1  72.4  17.0
  8.|-- shops.myshopify.com        0.0%    10   18.4  17.9  15.0  23.3   2.4

 ~/repos/shopify-cli-v3-test                                              took 15s  at 11:22:36 

> mtr shopify.com --report -c 10
Start: 2024-02-16T11:23:21+0100
HOST: david-pc                     Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- fritz.box                  0.0%    10    0.8   0.8   0.6   1.4   0.2
  2.|-- ipxyz.static.kabel-d       0.0%    10   11.1  11.5  10.1  14.3   1.3
  3.|-- ipxyz.static.kabel-d       0.0%    10   13.5  11.9   9.0  16.4   2.5
  4.|-- 145.254.3.196              0.0%    10   12.7  12.0   9.4  19.0   2.9
  5.|-- 145.254.2.179              0.0%    10   17.6  17.1  15.9  19.3   1.0
  6.|-- 162.158.84.8              30.0%    10   21.2  22.7  16.8  36.8   6.7
  7.|-- 172.71.244.3               0.0%    10   20.2  23.0  16.5  33.2   6.4
  8.|-- checkout.shopify.com       0.0%    10   19.0  17.4  15.6  21.9   2.0

 ~/repos/shopify-cli-v3-test                                              took 15s  at 11:23:36 

grafik

Is it possible that shopify has a rate limit or something similar set up at Cloudflare which slows the connection down?

github-actions[bot] commented 7 months ago

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.

dzschille commented 7 months ago

The issue seems a lot better now: the same shopify theme pull --store=shpfy-cli-test.myshopify.com --verbose now takes only 2:30 minutes. And i see now in the verbose output that the slowdown is indeed because of an API limit (Near API call limit, waiting 2 seconds):

...
┃ DEBUG **Near API call limit, waiting 2 seconds**
┃ DEBUG GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json?asset%5Bkey%5D=templates%2Fproduct.json with request_id: fbed5c88-dcfd-4ea1-ab05-1b4600dc4d60-1712573097
┃ DEBUG get templates/blog.json                                                                                                                                                                97% 
┃                                                                                                                                                                                              97% DEBUG get templates/index.json
┃ DEBUG GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json?asset%5Bkey%5D=templates%2Fblog.json with request_id: d2ae8eaf-bdf6-4b43-b2d0-f154e26b676c-1712573099
┃ DEBUG get templates/list-collections.json
┃ DEBUG GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json?asset%5Bkey%5D=templates%2Findex.json with request_id: cdee77c0-5aab-4fba-9298-fc8c81fb9269-1712573099
┃ DEBUG get templates/page.json
┃ DEBUG GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json?asset%5Bkey%5D=templates%2Flist-collections.json with request_id: e515474d-9eef-4c0d-9534-1d6394ba0765-1712573100
┃ DEBUG get sections/header-group.json
┃ DEBUG GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json?asset%5Bkey%5D=templates%2Fpage.json with request_id: f051baab-b2e8-4e58-94ec-3959c0aab6d7-1712573100
┃ DEBUG get sections/footer-group.json
┃ DEBUG GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json?asset%5Bkey%5D=sections%2Fheader-group.json with request_id: e48ad20e-059e-453e-80af-bde7d91990c0-1712573100
┃ DEBUG **Near API call limit, waiting 2 seconds**
┃ DEBUG GET https://shpfy-cli-test.myshopify.com/admin/api/unstable/themes/133896143043/assets.json?asset%5Bkey%5D=sections%2Ffooter-group.json with request_id: 2109acdf-3439-4b12-95c2-811b03b9390a-1712573100