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]: Update webhook uris during development (toml config) #4209

Open
ozzyonfire opened this issue Jul 15, 2024 · 9 comments
Open

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

ozzyonfire opened this issue Jul 15, 2024 · 9 comments
Labels
Type: Enhancement New feature or request

Comments

@ozzyonfire
Copy link

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.

@mufftee
Copy link

mufftee commented Jul 24, 2024

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

@ozzyonfire
Copy link
Author

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.

@echocrow
Copy link

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.

@ccharest93
Copy link

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.

@hydrocat
Copy link

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

@gonzaloriestra
Copy link
Contributor

cc: @anitameh

@BaggioGiacomo
Copy link

BaggioGiacomo commented Sep 18, 2024

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

@bowenng
Copy link

bowenng commented Sep 19, 2024

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?

@BaggioGiacomo
Copy link

@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

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

8 participants