Open 0xtlt opened 2 years ago
Hey, can you provide more info? We're using shopify CLI's development themes. These should not appear in the UI. If not, then that would be a shopify-cli bug.
https://github.com/Shopify/lighthouse-ci-action/blob/main/entrypoint.sh#L89 https://github.com/Shopify/lighthouse-ci-action/blob/main/entrypoint.sh#L143
Are you using an old version of the CI action by any chance? I think the old version used theme-kit and that might be the cause for issue.
It's supposed to be this:
- name: Lighthouse
uses: shopify/lighthouse-ci-action@1.0
Hey, I'm having the same issue. Shopify has a limit of 100 development themes, and since the lighthouse CI action seems to create new themes without deleting them it hits the limit when the action is being run regularly.
422 (ShopifyCLI::API::APIRequestClientError) {"errors":{"base":["A shop may only have 100 development themes"]}}
The same problem can be found here in this Shopify cummunity forum post https://community.shopify.com/c/technical-q-a/shopify-theme-serve-throwing-error-quot-a-shop-may-only-have-100/td-p/1368567
My guess is the original poster is referring to this solution, manually deleting the development themes using themekit/ShopifyCLI rather than manually deleting them in the Shopify admin
If you want to clean the developments themes :
echo "Cleaning..."
while true; do
shopify theme delete -a -f <<<"\n"
done
Update: Looks like upgrading shopify-cli from 2.13.0
to 2.19.0
avoids the errors below (explanation: "You can't use Shopify CLI with development stores if you only have Partner staff member access."). Still have mysterious excess dev themes i need to purge
Experienced this too, shopify theme list
errors with
SHOPIFY_CLI_STACKTRACE=1 shopify theme list
⭑ List of [REDACTED].myshopify.com themes:
✗ An unexpected error occured.
To submit an issue include the stack trace.
? Send an anonymized error report to Shopify? (You chose: Yes, send)
/usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/lib/shopify_cli/api.rb:74:in `block in request': 403 (ShopifyCLI::API::APIRequestForbiddenError)
{"errors":"Unauthorized Access"}
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/util.rb:172:in `retry_after'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/lib/shopify_cli/api.rb:89:in `request'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/lib/shopify_cli/admin_api.rb:92:in `block in rest_request'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/util.rb:172:in `retry_after'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/lib/shopify_cli/admin_api.rb:95:in `rest_request'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/lib/shopify_cli/theme/theme.rb:208:in `fetch_themes'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/lib/shopify_cli/theme/theme.rb:167:in `all'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/lib/project_types/theme/presenters/themes_presenter.rb:28:in `all_themes'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/lib/project_types/theme/presenters/themes_presenter.rb:16:in `all'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/lib/project_types/theme/commands/list.rb:14:in `call'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/lib/shopify_cli/command/sub_command.rb:16:in `call'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/lib/shopify_cli/command.rb:27:in `call'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/lib/shopify_cli/core/executor.rb:17:in `block (2 levels) in call'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:37:in `block (2 levels) in with_logging'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/vendor/deps/cli-ui/lib/cli/ui/stdout_router.rb:169:in `with_id'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:36:in `block in with_logging'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/vendor/deps/cli-ui/lib/cli/ui.rb:176:in `log_output_to'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:35:in `with_logging'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/lib/shopify_cli/core/executor.rb:16:in `block in call'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:45:in `block (2 levels) in with_traps'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:55:in `twrap'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:44:in `block in with_traps'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:55:in `twrap'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:43:in `with_traps'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/lib/shopify_cli/core/executor.rb:15:in `call'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/lib/shopify_cli/core/entry_point.rb:24:in `block in call'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/lib/shopify_cli/core/monorail.rb:30:in `log'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/lib/shopify_cli/core/entry_point.rb:23:in `call'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/bin/shopify:50:in `block (2 levels) in <top (required)>'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb:75:in `handle_abort'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb:21:in `call'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/bin/shopify:49:in `block in <top (required)>'
from /usr/local/Cellar/shopify-cli/2.13.0/gems/shopify-cli-2.13.0/bin/shopify:59:in `<top (required)>'
from /usr/local/bin/shopify:7:in `load'
from /usr/local/bin/shopify:7:in `<main>'
OK even after updating to 2.19.0
which successfully lists 100 themes via shopify theme list
, and deleting many of them with a looping shopify theme delete -a -d -f
, I always still have 100 themes shown under shopify theme list
Actually, if i manually delete one by one via interactive prompt shopify theme delete -a
I can actually get the number to start reducing, but it is very slow.
Jumping in to revive this. I'm experiencing the same error:
Configuring shopify CLI
Will run Lighthouse CI on https://***
==============================
Creating development theme
╭─ error ──────────────────────────────────────────────────────────────────────╮
│ │
│ [422] API request unprocessable content: {"base":["A shop may only have │
│ 100 development themes"]} │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
==============================
I found that using the Shopify CLI shopify theme list
command revealed what others have reported — 99 development themes that were never deleted after running the lighthouse-ci-action:
name role id
─────────────────────────────────── ───────────────────── ─────────────
Dawn [live] #164969447728
Development (6324e9-62be2aa14f16) [development] #166956269872
Development (c90ee3-d355c4239a31) [development] #166956859696
Development (25ae91-134baec6f283) [development] #166957515056
Development (2a51ce-891573a75df3) [development] #166957646128
Development (a409e8-85eb83b1f6cb) [development] #166959579440
Development (6b338b-ace2fe1b34f8) [development] #166959808816
Development (56d690-434c7babe82a) [development] #166959841584
Development (e1184a-429a58582a6d) [development] #166960365872
Development (456c04-25cccbb8132c) [development] #166964166960
Development (1f32de-7af9d794609d) [development] #166982025520
Development (9d7a84-873bc89fa1b9) [development] #166982811952
Development (2c4632-7e4fd59e973d) [development] #166983008560
Development (3136cc-3069b8f764f9) [development] #166983270704
Development (f1b88e-ab1434ccc240) [development] #166983893296
Development (beabab-20b56f96a90d) [development] #166984483120
Development (2a613d-5da3dd13605e) [development] #166984548656
Development (977adb-7a9e96ccb93d) [development] #166984843568
Development (9dec56-56a4bdbfe41d) [development] #166986711344
Development (20e099-6eab977e61ef) [development] #166986744112
Development (2085d8-0ee34cb4f73c) [development] #166986776880
Development (11e500-9ea0bf5c67c5) [development] #166986809648
Development (f9380f-12835d7cb385) [development] #166987432240
Development (2651ee-a1f9d1044d96) [development] #166991528240
Development (ee1de6-74f537fc593a) [development] #166991561008
Development (53fbeb-b49984137f72) [development] #166991593776
Development (4afae2-aa95dd3f08cd) [development] #166991823152
Development (db0401-4d0942f5eae9) [development] #166992478512
Development (56ea42-7fcb8a786a47) [development] #166992806192
Development (4b662b-3129f2c8050b) [development] #166992838960
Development (a25c20-d5a7e713fe37) [development] #166992937264
Development (a06797-ca9d65cb693c) [development] #166992970032
Development (725eea-ea55557d9737) [development] #166993002800
Development (35e2a4-112f1216be6b) [development] #166993068336
Development (07c497-4aba67e17a8e) [development] #166993232176
Development (eef6f2-da6fb056fe51) [development] #166993396016
Development (504437-578680f409ae) [development] #166993494320
Development (7e1355-7673918ffba7) [development] #166993559856
Development (538b36-a832b4de7351) [development] #166993592624
Development (e15f1d-c93043a4b443) [development] #166993690928
Development (e6d7c7-68561e6df5bc) [development] #166993756464
Development (fe86db-ab0d7c99622c) [development] #167006011696
Development (657633-4eb6e93207e8) [development] #167006044464
Development (f2d1b7-199a67c93b6b) [development] #167006110000
Development (06013c-f343a7868eda) [development] #167006175536
Development (ca7199-fa4105ff79c7) [development] #167006208304
Development (3342d0-51264f873773) [development] #167006241072
Development (01a5e1-a7271cfae7f9) [development] #167007813936
Development (b54901-ddc3f4011e85) [development] #167009583408
Development (e1c400-662fbc735094) [development] #167009616176
Development (b657ba-bba7ebb7ad0e) [development] #167011254576
Development (e1233f-90a15c8c8928) [development] #167011287344
Development (26e2ff-bf303e1c181c) [development] #167011352880
Development (d781e7-173ecd75f8ab) [development] #167012139312
Development (17c29e-9b53c2f2061c) [development] #167012303152
Development (485909-d286e1aae154) [development] #167013089584
Development (e0ca4f-93666f1da84c) [development] #167013155120
Development (8f70db-907e215260e3) [development] #167014498608
Development (df4dac-5f565e72278b) [development] #167014826288
Development (705c15-781ca1a8d3d8) [development] #167032979760
Development (1fb1de-cffc38451d7f) [development] #167033766192
Development (166eef-cec00814fae2) [development] #167033995568
Development (18acb0-e65722225470) [development] #167034126640
Development (a7057a-d1f98e44dd83) [development] #167035175216
Development (da776a-af5113ad6705) [development] #167035339056
Development (da7e56-abb767adbdcc) [development] #167035371824
Development (acc4e3-ad6b120694e1) [development] #167035535664
Development (a93657-84b30901e628) [development] #167035568432
Development (0376e2-a0ec7bd01889) [development] #167035765040
Development (610188-018c7750db40) [development] #167035797808
Development (c37e58-978395252dcd) [development] #167035830576
Development (084272-1336dff1df17) [development] #167035896112
Development (aaf4a0-06e135cb12b0) [development] #167035994416
Development (1a18a1-9a81a5f1763b) [development] #167036027184
Development (2acf52-6f4a1cb1bcbf) [development] #167036059952
Development (70aea0-bf891433b3a3) [development] #167036289328
Development (3274b6-1a5321799adc) [development] #167036322096
Development (b6d955-11bee3bceb52) [development] #167036617008
Development (17a15a-bb83e8d2b293) [development] #167036649776
Development (2b130a-d036fb633684) [development] #167036682544
Development (9bc386-491607ed24dc) [development] #167036715312
Development (4dfc1f-968d8caa0e67) [development] #167036780848
Development (510ffe-8579469ee8e6) [development] #167037763888
Development (62c56e-04f1d2f4d497) [development] #167037796656
Development (a1fcb6-687cc5c9086f) [development] #167037862192
Development (c1254d-af1b25357388) [development] #167037927728
Development (06c760-904f1f6a9f6c) [development] #167038255408
Development (5f5563-2acbdd32ee5f) [development] #167038288176
Development (eb0e0d-a72cefee35a1) [development] #167038320944
Development (d10a80-746ba4c565d3) [development] #167038353712
Development (7e25c9-d7bcfa0db6da) [development] #167038845232
Development (05c53a-b0faa0b3344a) [development] #167038878000
Development (2f62cc-cda5c62b98aa) [development] #167039238448
Development (182a43-d44d83f6d503) [development] #167100318000
Development (1dc1cd-457ff5fbdc2e) [development] #167100481840
Development (f25e6d-e4c87f6f208b) [development] #167100842288
Development (0a472c-aa08b39a3699) [development] #167110148400
Development (ee2670-b384d532e6f5) [development] #167127744816
Development (667482-gg-MacBook-Pro) [development] [yours] #167131840816
Many thanks to @0xtlt for posting the script to automate removing these, but I have to wonder how this is happening. @charlespwd , is there a setting or flag that I might have missed that could be causing this? It seems like very few reports of this but certainly enough to rule out one offs, which is also perplexing.
I unfortunately ran into an infinite loop using the bash script in the thread which I'm sure was user error. Admittedly not being much of a bash guy, I got this from an AI assistant that worked like a charm and wanted to share in case someone else might find it helpful.
This goes through all themes and removes any of them with the [development]
role without you having to do anything other than run the script.
Here's a commented version:
# Print a message indicating the start of the cleaning process
echo "Cleaning..."
# Get a list of all theme IDs with the role "[development]"
themes=$(shopify theme list | awk 'NR>1 && tolower($3) == "[development]" {print $2}')
# Loop through each theme ID
while read -r theme_id; do
# Print a message indicating the deletion of the theme with its ID
echo "Deleting theme with ID: $theme_id"
# Delete the theme using the shopify theme delete command
# -a: Delete all occurrences of the theme
# -f: Force delete without confirmation
# <<<"\n": Provide a newline character as input to confirm deletion
shopify theme delete --theme "$theme_id" -a -f <<<"\n"
done <<< "$themes"
# Print a message indicating the remaining themes
echo -e "\nRemaining themes:"
# List the remaining themes using the shopify theme list command
shopify theme list
And one without the comments that you can drop into your terminal and hit go:
echo "Cleaning..."
themes=$(shopify theme list | awk 'NR>1 && tolower($3) == "[development]" {print $2}')
while read -r theme_id; do
echo "Deleting theme with ID: $theme_id"
shopify theme delete --theme "$theme_id" -a -f <<<"\n"
done <<< "$themes"
echo -e "\nRemaining themes:"
shopify theme list
For anyone on Windows with this issue:
powershell
# Get the list of themes
$themes = shopify theme list
# Split the output into lines
$themeLines = $themes -split "`n"
# Loop through each line of the theme list
foreach ($line in $themeLines) {
# Use a regex to extract the theme name and role
if ($line -match '^(?<name>.+?)\s+\[(?<role>.+?)\]\s+(?<id>#\d+)') {
$themeName = $matches['name']
$themeRole = $matches['role']
$themeID = $matches['id'].TrimStart('#') # Remove the leading # from the ID
# Check if the theme is a development theme
if ($themeRole -eq 'development') {
# Delete the theme
Write-Host "Deleting theme: $themeName with ID: $themeID"
shopify theme delete --theme "$themeID" -a -f
}
}
}
Hi,
I use this action for 1 month now for projects with my developers, and each week I need to delete manually each of the themes created by this action.
It only happens since we added this action to our workflows.