cli icon indicating copy to clipboard operation
cli copied to clipboard

[Feature]: Update webhook uris during development (toml config)

Open ozzyonfire opened this issue 1 year ago • 10 comments

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.

ozzyonfire avatar Jul 15 '24 20:07 ozzyonfire

Nice, took me 3 Days until i found this post.. i am so mad.

mufftee avatar Jul 24 '24 12:07 mufftee

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.

ozzyonfire avatar Jul 29 '24 13:07 ozzyonfire

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.

echocrow avatar Aug 13 '24 10:08 echocrow

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 avatar Aug 14 '24 10:08 ccharest93

@ccharest93 Thanks for clarifying. I've been banging my head for a week on this !

hydrocat avatar Aug 17 '24 16:08 hydrocat

cc: @anitameh

gonzaloriestra avatar Sep 11 '24 11:09 gonzaloriestra

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 👍🏻

BaggioGiacomo avatar Sep 18 '24 08:09 BaggioGiacomo

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 avatar Sep 19 '24 01:09 bowenng

@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

BaggioGiacomo avatar Sep 19 '24 06:09 BaggioGiacomo

==

@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

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.

bowenng avatar Sep 24 '24 03:09 bowenng

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.

github-actions[bot] avatar Nov 05 '24 03:11 github-actions[bot]

This is still relevant Shopify CLI v3.69.4

grundmanise avatar Nov 05 '24 08:11 grundmanise

it is relevant!

mblaw1011 avatar Nov 28 '24 01:11 mblaw1011

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.

github-actions[bot] avatar Jan 09 '25 03:01 github-actions[bot]

still relevant 🫡

echocrow avatar Jan 09 '25 14:01 echocrow

+1 to fix this. Really annoying as is.

ryanolf avatar Jan 16 '25 11:01 ryanolf

+1

sebastianpisula avatar Jan 16 '25 11:01 sebastianpisula

@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.

ryanolf avatar Jan 16 '25 11:01 ryanolf

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.

ozzyonfire avatar Jan 17 '25 19:01 ozzyonfire

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.

emanuelrocha-skrey avatar Feb 07 '25 12:02 emanuelrocha-skrey

Oh my word, just spent 4 hours banging my head about this issue. 🙈 thanks for pointing it out.

ejscheepers avatar Feb 25 '25 16:02 ejscheepers

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 avatar Feb 26 '25 08:02 gonzaloriestra

@gonzaloriestra If this is still an issue, why close this/mark this complete? I just ran into this issue.

sameerxanand avatar Mar 09 '25 03:03 sameerxanand

@sameerxanand because this is a feature request and we are already working on it. Just to clean up!

gonzaloriestra avatar Mar 10 '25 08:03 gonzaloriestra

Not solved yet. Can you add some notice in documentation at least?

madfcat avatar Jun 17 '25 09:06 madfcat

+1 still occuring

ZacharySpilinek avatar Jun 30 '25 15:06 ZacharySpilinek