This repository has been archived by the owner on Nov 30, 2022. It is now read-only.
Add backward compatibility with REST-style webhook topics (e.g. "orders/create") #868
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
v17 requires webhooks to be configured with GraphQL-style webhook topics (e.g. "ORDERS_CREATE") instead of the previously-used REST-style webhook topics (e.g. "orders/create"). If there are webhooks in the config and
topic
isn't changed on all of them during the upgrade process, an exception is thrown that it isn't terribly clear how to fix:Variable $topic of type WebhookSubscriptionTopic! was provided invalid value
.This PR adds backward compatibility with REST-style webhook topics through the use of a new utility method:
Util::getGraphQLWebhookTopic(string $topic): string
When the webhooks in the config are being created on the store, the
topic
is run through this method to ensure that the GraphQL-style topic is being used, even if the topic in the config is REST style.I also updated the
shopify-app:make:webhook
command output to include the GraphQL-style topic and the actual webhook handler URL (instead of a generic URL). For example: