support relative paths to `application_url` for declarative webhooks
WHY are these changes introduced?
Closes https://github.com/Shopify/develop-app-management/issues/1599
WHAT is this pull request doing?
- adds support for declarative webhook
uris that are relative to theapplication_urlex:
application_url = "https://my-app-url.com"
[[webhooks.subscriptions]]
topics = ["products/create", "products/update"]
uri = "/products" # https://my-app-url.com/products
-
this is especially useful when using
app devas the app url changes every time -
this also transforms the config on
app config link, and we simplify like we do with thetopicsarray ex. if you have
application_url = "https://my-app-url.com"
[[webhooks.subscriptions]]
topics = ["products/create"]
uri = "https://my-app-url.com/products"
[[webhooks.subscriptions]]
topics = ["orders/create"]
uri = "https://my-app-url.com/orders"
and link, we will simplify the config to
application_url = "https://my-app-url.com"
[[webhooks.subscriptions]]
topics = ["products/create"]
uri = "/products"
[[webhooks.subscriptions]]
topics = ["orders/create"]
uri = "/orders"
- There is also nothing stopping anyone from creating a bad relative path like
application_url = "https://my-app-url.com"
[[webhooks.subscriptions]]
topics = ["products/create"]
uri = "//////products" # https://my-app-url.com//////products
- As technically to https spec, this is still a valid URL. We could parse out extra forward slashes, but I think a developer would realize this once they see it in their TOML or on the dashboard
- The
application_urlcannot end in a forward slash so this protects against this on the app url side
How to test your changes?
- create an app and opt into the versioned config and declarative webhooks betas (both app and dev shop)
- create some webhook subscriptions with a relative path
- deploy the version
- go to the dashboard, you should see the full URL
- you can also link and make sure the toml does not change (unless it is this simplification case like mentioned)
Checklist
- [x] I've considered possible cross-platform impacts (Mac, Linux, Windows)
- [x] I've considered possible documentation changes
- [x] I've made sure that any changes to
devordeployhave been reflected in the internal flowchart.
Coverage report
St.:grey_question: |
Category | Percentage | Covered / Total |
|---|---|---|---|
| π‘ | Statements | 73.92% (+0.04% πΌ) |
6602/8931 |
| π‘ | Branches | 70.7% (+0.09% πΌ) |
3204/4532 |
| π‘ | Functions | 73.42% (-0.01% π») |
1732/2359 |
| π‘ | Lines | 74.94% (+0.04% πΌ) |
6225/8307 |
Test suite run success
1584 tests passing in 738 suites.
Report generated by π§ͺjest coverage report action from d3daf827681d2254ee318fd12411ff30b7d74b04
We detected some changes at either packages/*/src or packages/cli-kit/assets/cli-ruby/** and there are no updates in the .changeset. If the changes are user-facing, run "pnpm changeset add" to track your changes and include them in the next release CHANGELOG.
This PR 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.
wip
This PR 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.
wip
https://github.com/Shopify/cli/pull/3948