Shopify / cli

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

[Bug]: Pushing context templates throws error due to cli file upload order for theme creation #4711

Closed Jay-Plumb closed 22 hours ago

Jay-Plumb commented 1 day ago

Please confirm that you have:

In which of these areas are you experiencing a problem?

Theme

Expected behavior

I have a github action that creates a shopify theme. On first run, I always see the following error when using context templates.

Existing issues: https://github.com/Shopify/cli/issues/3301 is the same issue but I can see was closed out

Actual behavior

The following error is observed: update templates/index.context.b2b.json: Parent filename 'index.json' does not exist. Please enter a valid filename

Verbose output

╭─ info ───────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  Using applicable flags from development environment:                        │
│                                                                              │
│    • store: balsam-b2b-us-staging.myshopify.com                              │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯

┏━━ Pushing theme files to jason_plumb/sc-49821/image-blocks-section (#139219075223) on balsam-b2b-us-staging.myshopify.com 
┃ 25l 0%  
┃  0%  
┃  1%  
┃  1%  
┃  2%  
┃  2%  
┃  3%  
┃  3%  
┃  4%  
┃  4%  
┃  5%  
┃  5%  
┃  6%  
┃  6%  
┃  7%  
┃  7%  
┃  8%  
┃  8%  
┃  9%  
┃  9%  
┃  10% 
┃  10% 
┃  11% 
┃  11% 
┃  11% 
┃  12% 
┃  12% 
┃  13% 
┃  13% 
┃  14% 
┃  14% 
┃  15% 
┃  15% 
┃  16% 
┃  16% 
┃  17% 
┃  17% 
┃  18% 
┃  18% 
┃  19% 
┃  19% 
┃  20% 
┃  20% 
┃  21% 
┃  21% 
┃  22% 
┃  22% 
┃  22% 
┃  23% 
┃  23% 
┃  24% 
┃  24% 
┃  25% 
┃  25% 
┃  26% 
┃  26% 
┃  27% 
┃  27% 
┃  28% 
┃  28% 
┃  29% 
┃  29% 
┃  30% 
┃  30% 
┃  31% 
┃  31% 
┃  32% 
┃  32% 
┃  33% 
┃  33% 
┃  33% 
┃  34% 
┃  34% 
┃  35% 
┃  35% 
┃  36% 
┃  36% 
┃  37% 
┃  37% 
┃  38% 
┃  38% 
┃  39% 
┃  39% 
┃  40% 
┃  40% 
┃  41% 
┃  41% 
┃  42% 
┃  42% 
┃  43% 
┃  43% 
┃  44% 
┃  44% 
┃  44% 
┃  45% 
┃  45% 
┃  46% 
┃  46% 
┃  47% 
┃  47% 
┃  48% 
┃  48% 
┃  49% 
┃  49% 
┃  50% 
┃  50% 
┃  51% 
┃  51% 
┃  52% 
┃  52% 
┃  53% 
┃  53% 
┃  54% 
┃  54% 
┃  55% 
┃  55% 
┃  55% 
┃  56% 
┃  56% 
┃  57% 
┃  57% 
┃  58% 
┃  58% 
┃  59% 
┃  59% 
┃  60% 
┃  60% 
┃  61% 
┃  61% 
┃  62% 
┃  62% 
┃  63% 
┃  63% 
┃  64% 
┃  64% 
┃  65% 
┃  65% 
┃  66% 
┃  66% 
┃  66% 
┃   • 02:37:34 ERROR  » update templates/index.context.b2b.json:
┃  67% 
┃  67% 
┃   Parent filename 'index.json' does not exist. Please enter a valid filename
┃  68% 
┃  68% 
┃  69% 
┃  69% 
┃  70% 
┃  70% 
┃  71% 
┃  71% 
┃  72% 
┃  72% 
┃  73% 
┃  73% 
┃  74% 
┃  74% 
┃  75% 
┃  75% 
┃  76% 
┃  76% 
┃  77% 
┃  77% 
┃  77% 
┃  78% 
┃  78% 
┃  79% 
┃  79% 
┃  80% 
┃  80% 
┃  81% 
┃  81% 
┃  82% 
┃  82% 
┃  83% 
┃  83% 
┃  84% 
┃  84% 
┃  85% 
┃  85% 
┃  86% 
┃  86% 
┃  87% 
┃  87% 
┃  88% 
┃  88% 
┃  88% 
┃  89% 
┃  89% 
┃  90% 
┃  90% 
┃  91% 
┃  91% 
┃  92% 
┃  92% 
┃  93% 
┃  93% 
┃  94% 
┃  94% 
┃  95% 
┃  95% 
┃  96% 
┃  96% 
┃  97% 
┃  97% 
┃  98% 
┃  98% 
┃  99% 
┃  99% 
┃  100%
┃  100%
25h┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ (78.35s) 
Error: Process completed with exit code 1.

Reproduction steps

  1. Create a file named index.context.b2b.json with content:
 "parent": "index.json",
  "context": {
    "b2b": true
  }
  1. Push to a new theme: shopify theme push --unpublished --theme='test' --environment='development' --path=''. Note that this only happens when running a CI/CD integration and not from the command line
  2. Observe the error update templates/index.context.b2b.json: Parent filename 'index.json' does not exist. Please enter a valid filename

Operating System

darwin-x64

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

@shopify/cli/3.68.0

Shell

No response

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

v22.9.0

What language and version are you using in your application?

No response

karreiro commented 22 hours ago

Thank you for reporting this, @Jay-Plumb! Upgrading to Shopify 3.69.0 should resolve this issue.

This bug was occurring in the legacy implementation of the shopify theme push command (and Shopify CLI 3.68.x was still using the legacy one in some scenarios, as the logs show it's the legacy one running).

However, Shopify CLI 3.69.0 runs the new implementation of the push command in all scenarios by default, so you shouldn't experience this issue there.

With that in mind, I'm closing this one, but thank you for reporting it!