Reputation: 11
I am using Shopify's recommended remix app. In the root directory I have a shopify.web.toml file (the default)
name = "app"
roles = ["frontend", "backend"]
webhooks_path = "/webhooks"
[commands]
dev = "npm exec remix dev"
[hmr_server]
http_paths = ["/ping"]
When I run the command npm run dev -- --tunnel-url https://shares-cc-scientific-participating.trycloudflare.com:3000
this works perfectly and I can access the app in my test store.
Now I want to add a background process using the "background" role talked about in this link: https://shopify.dev/docs/apps/tools/cli/structure#background-process
I made a folder in the root directory called 'background' and I have a JS file, a package.json, and another shopify.web.toml file with this in it
name = "pubsub"
roles = ["background"]
[commands]
dev = "node pubsub.js"
When I run npm run dev -- --tunnel-url https://shares-cc-scientific-participating.trycloudflare.com:3000
in the root directory, both processes startup (U can see output from each process in the terminal) however when I try to access the app within my test shop it won't load and I get this error:
"Error forwarding web request: AggregateError"
In my local cloudflared logs I get this error:
2024-02-01T18:26:40Z ERR error="Incoming request ended abruptly: context canceled" cfRay=84ec3e5853c27bd6-ATL event=1 originService=http://localhost:3000
2024-02-01T18:26:40Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=0 dest=https://opens-provinces-gmc-pan.trycloudflare.com/webhooks event=0 ip=198.41.200.33 type=http
I'm not entirely sure why and I don't know how making a background process with another shopify.web.toml is causing the error when it works when I don't have the second process running.
I have read the docs over and over to try to understand why this would happen but there isn't much in the way of explaining background process besides the link I sent above. I also asked the shopify community but they didn't prove to be very helpful.
Upvotes: 1
Views: 345
Reputation: 987
This has been fixed in @shopify/[email protected]
.
https://github.com/Shopify/cli/issues/4309
Upvotes: 0