Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Ignore globs from .gitignore when looking for shopify.web.toml #3702

Open
bradylill opened this issue Apr 11, 2024 · 2 comments
Open
Labels
Type: Enhancement New feature or request

Comments

@bradylill
Copy link

What area(s) will this request affect?

Deployment

What type of change do you want to see?

New feature

Overview

I'm currently using sst.dev to deploy some of my infrastructure to support our Shopify app. I notice that sst will copy the shopify.web.toml file multiple time to it's local cache directory located at .sst/.

After a sst deploy if I run shopify app deploy it will throw an error saying "You can only have one web with the backend role in your app"

On further inspection I noticed that the function loadWebs will automatically look for any shopify.web.toml file. If I look at the value of webTomlPaths in that function I can see it found the following paths:

  • ./myapp/shopify.web.toml
  • ./myapp/.sst/dist/asset.1c2820b0c6ebda7219ed80571b3403754fad21f218a63c84f4c2343838f6c325/shopify.web.toml
  • ./myapp/.sst/dist/asset.26364bf4695807ba459400fe064778d5687f8f8568eb65e9ebcbd5e65106cc6f/shopify.web.toml
  • ./myapp/.sst/dist/asset.b13cfda5f566a8a060902ce8e5de6140482397ca4f5b7000858edfb54a0ce02c/shopify.web.toml
  • ./myapp/.sst/dist/asset.e92036fdbd0dbc9c73bc238a935ab561ced0076bb90cf3cd8fdb4c6541295cc6/shopify.web.toml

It would be nice if there was a way to have the contents of .gitignore added to webConfigGlobs so that it would ignore any other cases like this. Personally I would always want it to use .gitignore but I imagine there are cases where someone would want that to be configurable.

This might also be classified as a bug, but I figured it was a bit of an edge case.

I'm also happy to open a PR around this if it's something ya'll deem useful. My workaround at the moment is to force delete the .sst directory before running shopify app deploy in our ci/cd pipeline.

Motivation

I was running into this issue when trying to run shopify app deploy while also working with sst.dev. Figured it would be something that others might run into.

@bradylill bradylill added the Type: Enhancement New feature or request label Apr 11, 2024
@shauns
Copy link
Contributor

shauns commented Apr 23, 2024

You could also workaround by putting your web.toml in a specific directory and setting web_directories accordingly

A PR would be very welcome! I'm not sure about loading from .gitignore by default -- that would be a change that might break some unusual existing workflows. Maybe we could make web_directories smarter -- if an option starts with a ! include it in the negation list (we already do some of this to avoid loading from node_modules for instance).

@thenbe
Copy link

thenbe commented Apr 24, 2024

This is also an issue when using direnv.

$ shopify app info
CURRENT APP CONFIGURATION

💡 To change these, run `dev --reset`

YOUR PROJECT
Root location   /home/nbe/projects/playground/d-shopifie-2

DIRECTORY COMPONENTS
web
📂 web
    📂 remix (frontend,backend)
    📂 remix (frontend,backend)   .direnv/flake-inputs/bwwr59ppz8ibh1r0dvazdy6j7cbywsyc-source
! You can only have one web with the frontend role in your app

Extensions with errors

TOOLING AND SYSTEM
Shopify CLI       3.59.1
Package manager   pnpm
OS                linux-amd64
Shell             /run/current-system/sw/bin/zsh

Workaround

Here's a workaround:

# file: shopify.app.*.toml

# default value: https://github.com/Shopify/cli/blob/f12748a53845efd9ba58595912d455a3aafa0890/packages/app/src/cli/models/app/loader.ts#L365
- web_directories = ["**"]
# amended value (only looks for a shopify.web.toml in the current directory): https://shopify.dev/docs/apps/structure#configuration
+ web_directories = ["."]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants