cli icon indicating copy to clipboard operation
cli copied to clipboard

support relative paths to `application_url` for declarative webhooks

Open alexanderMontague opened this issue 1 year ago β€’ 6 comments

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 the application_url ex:
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 dev as the app url changes every time

  • this also transforms the config on app config link, and we simplify like we do with the topics array 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_url cannot 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 dev or deploy have been reflected in the internal flowchart.

alexanderMontague avatar Feb 08 '24 16:02 alexanderMontague

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

github-actions[bot] avatar Feb 08 '24 16:02 github-actions[bot]

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.

github-actions[bot] avatar Feb 08 '24 16:02 github-actions[bot]

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.

github-actions[bot] avatar Mar 16 '24 03:03 github-actions[bot]

wip

alexanderMontague avatar Apr 11 '24 13:04 alexanderMontague

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.

github-actions[bot] avatar May 12 '24 03:05 github-actions[bot]

wip

alexanderMontague avatar May 17 '24 15:05 alexanderMontague

https://github.com/Shopify/cli/pull/3948

alexanderMontague avatar May 29 '24 20:05 alexanderMontague