Skip to content

[Shopify] Do not block shop disable, shop delete and company delete if webhook cannot be deleted in Shopify#6371

Merged
onbuyuka merged 7 commits intomainfrom
bugs/619586-ShpfyWebhookDisable
Feb 9, 2026
Merged

[Shopify] Do not block shop disable, shop delete and company delete if webhook cannot be deleted in Shopify#6371
onbuyuka merged 7 commits intomainfrom
bugs/619586-ShpfyWebhookDisable

Conversation

@onbuyuka
Copy link
Copy Markdown
Contributor

@onbuyuka onbuyuka commented Jan 29, 2026

Problem

When disabling a Shopify shop or deleting a shop/company, if the webhook subscription cannot be deleted in Shopify (e.g., due to invalid API credentials, network issues, or the store being disconnected), the operation would fail with an error like:

Error(s) on Shopify:
"[API] Invalid API key or access token (unrecognized login or wrong password)"

This blocked users from disabling or deleting shops even when the Shopify store was already disconnected or inaccessible.

Root Cause

The DeleteWebhookSubscription function was being called directly, which throws an error if the Shopify API call fails. Additionally, even when using a [TryFunction] wrapper, there were two issues:

  1. TryFunction return value not used: In AL, if a TryFunction's return value isn't consumed, it behaves like a regular method and errors are still raised to the user.

  2. Database writes inside TryFunction: The ExecuteGraphQL function writes to the log table, which is not allowed inside a TryFunction when called from certain contexts (like page triggers).

Solution

  1. Created a new wrapper codeunit "Shpfy Delete Webhook Subs." (ID 30458) that uses the Codeunit.Run() pattern instead of [TryFunction]. This pattern:

    • Catches and suppresses errors (returns false on failure)
    • Allows database write transactions inside the executed code
  2. Updated TryDeleteWebhookSubscription to use this codeunit pattern and return a Boolean result.

  3. Updated callers in ShpfyWebhooksMgt to properly consume the return value with if ... then; syntax.

Work Item(s)

AB#619586

@github-actions github-actions bot added the AL: Apps (W1) Add-on apps for W1 label Jan 29, 2026
@github-actions github-actions bot added this to the Version 28.0 milestone Jan 29, 2026
@onbuyuka onbuyuka marked this pull request as ready for review January 29, 2026 23:49
@onbuyuka onbuyuka requested a review from a team as a code owner January 29, 2026 23:49
@onbuyuka onbuyuka enabled auto-merge (squash) February 2, 2026 10:41
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 8, 2026

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

@onbuyuka onbuyuka closed this Feb 8, 2026
auto-merge was automatically disabled February 8, 2026 16:40

Pull request was closed

@onbuyuka onbuyuka reopened this Feb 8, 2026
@onbuyuka onbuyuka enabled auto-merge (squash) February 8, 2026 16:40
@onbuyuka onbuyuka merged commit 81ed60c into main Feb 9, 2026
52 checks passed
@onbuyuka onbuyuka deleted the bugs/619586-ShpfyWebhookDisable branch February 9, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants