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

Fix relative webhooks TOML transformation #4253

Merged
merged 2 commits into from
Jul 31, 2024

Conversation

gonzaloriestra
Copy link
Contributor

@gonzaloriestra gonzaloriestra commented Jul 31, 2024

WHY are these changes introduced?

Fixes https://shopify.zendesk.com/agent/tickets/49319741
Fixes Shopify/shopify-app-template-remix#776 (comment)

The link process rewrites the TOML to transform webhook URIs like https://example.com/webhooks to /webhooks when the app URL is https://example.com.

But when the app URL ends with a slash, like https://example.com/, then we were wrongly updating the webhook URI to webhooks, causing the deploy validation to fail.

WHAT is this pull request doing?

Remove the final slash from the app URL when doing that transformation, so the final result includes the required initial slash.

How to test your changes?

  • Create an app and run link
  • Update the application_url in the TOML to https://whatever.com/
  • Add a subscription in the TOML:
  [[webhooks.subscriptions]]
  topics = [ "app/uninstalled" ]
  uri = "https://whatever.com/webhooks"
  • Run deploy
  • Run link => it should rewrite the uri to /webhooks

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Contributor

Thanks for your contribution!

Depending on what you are working on, you may want to request a review from a Shopify team:

  • Themes: @shopify/advanced-edits
  • UI extensions: @shopify/ui-extensions-cli
    • Checkout UI extensions: @shopify/checkout-ui-extensions-api-stewardship
  • Hydrogen: @shopify/hydrogen
  • Other: @shopify/app-management

Copy link
Contributor

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
72.51% (+0.11% 🔼)
7848/10824
🟡 Branches
69.47% (+0.05% 🔼)
3863/5561
🟡 Functions
71.24% (+0.03% 🔼)
2061/2893
🟡 Lines
72.82% (+0.12% 🔼)
7412/10179

Test suite run success

1797 tests passing in 818 suites.

Report generated by 🧪jest coverage report action from 253d1ce

@gonzaloriestra
Copy link
Contributor Author

/snapit

@gonzaloriestra gonzaloriestra marked this pull request as ready for review July 31, 2024 12:33
Copy link
Contributor

🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm.

Test the snapshot by intalling your package globally:

pnpm i -g shopify@0.0.0-snapshot-20240731123431

After installing, validate the version by running just shopify in your terminal
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

@gonzaloriestra gonzaloriestra added this pull request to the merge queue Jul 31, 2024
Merged via the queue into main with commit 394ca71 Jul 31, 2024
1 check passed
@gonzaloriestra gonzaloriestra deleted the fix-relative-webhooks-rewrite branch July 31, 2024 13:08
@gonzaloriestra gonzaloriestra added the #gsd:36745 Declarative Webhooks label Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
#gsd:36745 Declarative Webhooks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shopify Deploy error on new relative URLs in declarative Webhooks in shopify.app.toml
3 participants