cli: [Bug]: The theme app extension can no longer find assets.

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.

In which of these areas are you experiencing a problem?

Extension

Expected behavior

I would like to be able to npm run deploy.

Actual behavior

Only the Theme App Extension has an error.

Verbose output

2024-02-01T00:53:37.936Z: Creating directory at /private/var/folders/v2/k_ddyzwx76736rs3zqp4dyfr0000gn/T/422b0f2258894781ea41a0ccaf514f4e...
2024-02-01T00:53:37.936Z: Sync-creating directory at /private/var/folders/v2/k_ddyzwx76736rs3zqp4dyfr0000gn/T/d1f943f3d04eb08fe401e55171a260d7/bundle...
2024-02-01T00:53:37.937Z: Creating an empty file at /private/var/folders/v2/k_ddyzwx76736rs3zqp4dyfr0000gn/T/d1f943f3d04eb08fe401e55171a260d7/bundle/.shopify...
reservation-ui           │ Running theme check on your Theme app extension...
Failed to get file size: Error: ENOENT: no such file or directory, stat 'assets/index.js'
reservation-ui           │
reservation-ui           │ Bundling theme extension reservation-ui...
2024-02-01T00:53:38.026Z: Copying file from extensions/reservation-ui/assets/index.js to /private/var/folders/v2/k_ddyzwx76736rs3zqp4dyfr0000gn/T/d1f943f3d04eb08fe401e55171a260d7/bundle/583513e6-dc17-4394-9305-f4dd24fc1cfc/assets/index.js...

Reproduction steps

  1. Update to the latest version (3.55.1) from 3.52.0
  2. npm run deploy

Operating System

Mac OS

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

3.55.1

Shell

zsh

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

v20.10.0

What language and version are you using in your application?

No response

### Tasks

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Reactions: 1
  • Comments: 28 (12 by maintainers)

Most upvoted comments

Thanks folks that should be enough to get me going. I’ll pick this up next.

Moving assets folder to root helped but it’s really ugly workaround which kills existing conventions. Can we get a proper fix in CLI?

Thank you for the tip to move the assets folder to the root - at least we can get our app back up and running while this issue is fixed!

If that’s really the case then maybe it’s just a matter of the theme check run not running at the correct root?

@charlespwd Yes, It seems to be the case. And it is consistent with my observations in the my previous comment

Exact set of commands that cause the problem

You can reproduce it with the freshly bootstrapped application like this:

pnpm create @shopify/app -d pnpm -p . --template=remix --name=test-theme-ext-error --flavor=javascript
cd test-theme-ext-error
pnpm generate extension --name=theme_ext # pick the theme app extension for type of extension when asked
# init asset
echo "console.log('blah');" > extensions/theme-ext/assets/test.js
# init block using this asset
echo '{% schema %}
  {
    "name": "Test",
    "target": "body",
    "javascript": "test.js",
    "settings": []
  }
{% endschema %}
' > extensions/theme-ext/blocks/test.liquid
# run the build (error should be in ouput)
pnpm shopify app build
# link assets to the root of project
ln -s $PWD/extensions/theme-ext/assets $PWD/assets
# run build again (no error)
pnpm shopify app build