cli
cli copied to clipboard
[Feature]: Update webhook uris during development (toml config)
What area(s) will this request affect?
App
What type of change do you want to see?
Substantial change to existing feature
Overview
Update webhook urls when we run shopify app dev and have automatically_update_urls_on_dev = true.
Motivation
Currently, if we setup our webhooks through the .toml file, we need to deploy in order for the changes to go live to our store.
However, the next time we run shopify app dev we will get a new tunnel url for our app. If we have automatically_update_urls_on_dev = true then all of our urls get changed except for the webhook ones. This leads to a somewhat clunky DX of then opening up a new terminal windows to quickly run shopify app deploy in order for the new urls to get updated.
The new way of configuring webhooks through the TOML is so great, I love this new experience, except for updating the urls.
Nice, took me 3 Days until i found this post.. i am so mad.
Ya this took me a while to really pin down. I put it in as a feature enhancement, but after reading some of the docs and comments on #4222 it sounds like this is actually a bug and it is, in fact, intended to update webhook uris during development.
lost a few hours due to this behavior too; been a rather confusing initial DX trailing Shopify webhooks for the first time, until you learn the hard way which URLs do update, which don't, and how to work around the issue.
echoing OP's current workaround has us run shopify app deploy every time after—and in parallel to—shopify app dev while working with webhooks, or just accept broken webhooks when working on something else.
getting relative webhook URLs to auto-update on dev when the cloudflare tunnel domain changes would make initial DX a lot less confusing, and streamline future development.
Just to clarify for others, the current fix is to run shopify app deploy and shopify app dev in separate terminals, making sure to run the dev process BEFORE the deploy process so that the new tunnel configurations are used and webhooks are successfully delivered.
@ccharest93 Thanks for clarifying. I've been banging my head for a week on this !
cc: @anitameh
You can also add a shopify.web.toml file with role background that perform the app deploy after the URLs are updated
Here's the documentation: https://shopify.dev/docs/apps/build/cli-for-apps/app-structure#background-process
I'm using the Shopify app ruby template. I've added a shopify.web.toml file on the root of the project:
roles = [ "background" ]
[commands]
dev = "bin/shopify app deploy -f"
When I run shopify app dev, the urls are updated and then the app is deployed 👍🏻
Thanks for posting this issue. Also tumbled into this while setting up webhook with relative path.
How is everyone dealing with the issue that testing locally needs to run deploy? What if your app is already serving production customers? How do we set up the project so deploy doesn't actually deploy the unstable changes to the customers?
@bowenng We need to deploy the app every time in development because the URL changes every time (cloudflare tunnel). Since it changes every time, you have to update the urls (for the app proxy, webhooks etc...) on Shopify
In production you won't have this problem since the URL is always the same
So, you need one .toml for the dev environment and one for the production environment. You have to link these toml to the correct app and you will be good to go!
This piece of documentation can help you
==
@bowenng We need to deploy the app every time in development because the URL changes every time (cloudflare tunnel). Since it changes every time, you have to update the urls (for the app proxy, webhooks etc...) on Shopify
In production you won't have this problem since the URL is always the same
So, you need one
.tomlfor the dev environment and one for the production environment. You have to link these toml to the correct app and you will be good to go!This piece of documentation can help you
Thanks, BaggioGiacomo. The documentation is very helpful. I do hope Shopify fixes this integration. It is bad dev experience having to deploy to test local changes.
This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.
P.S. You can learn more about why we stale issues here.
This is still relevant Shopify CLI v3.69.4
it is relevant!
This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.
P.S. You can learn more about why we stale issues here.
still relevant 🫡
+1 to fix this. Really annoying as is.
+1
@ozzyonfire Are you able to change the label type to bug? I wonder if it would get more attention. It's definitely a bug in my opinion.
I actually head back from Shopify on the PR that I created. They told me this was a WIP and their team was currently working on it... So hopefully we should see this fixed soon.
Had this issue and "fixed" it locally using shopify app dev --reset anytime I run my app.
It takes a bit longer to run, but the webhooks keep working.
Oh my word, just spent 4 hours banging my head about this issue. 🙈 thanks for pointing it out.
Hi! Thanks all for the feedback and sorry for the late response. We are aware of this issue and working to improve the experience, stay tuned!
@gonzaloriestra If this is still an issue, why close this/mark this complete? I just ran into this issue.
@sameerxanand because this is a feature request and we are already working on it. Just to clean up!
Not solved yet. Can you add some notice in documentation at least?
+1 still occuring