Skip to content

[Shopify] Handle deleted fulfillment service location in Shopify#6847

Merged
onbuyuka merged 1 commit intomainfrom
bugs/622988-ShpfyFulfillmentSvcUpdate
Feb 26, 2026
Merged

[Shopify] Handle deleted fulfillment service location in Shopify#6847
onbuyuka merged 1 commit intomainfrom
bugs/622988-ShpfyFulfillmentSvcUpdate

Conversation

@onbuyuka
Copy link
Contributor

@onbuyuka onbuyuka commented Feb 25, 2026

Problem

When a fulfillment service location is deleted in Shopify but the corresponding Shpfy Shop Location record still exists in Business Central, the GetLocation GraphQL query returns {"data":{"location":null}}. The code attempted to parse data.location.fulfillmentService as a single path, which fails because the null location token cannot be traversed to reach fulfillmentService. This left a stale record with Fulfillment Service Id = 0, causing UpdateFulfillmentServiceCallbackUrl to proceed with an invalid ID in the UpdateFulfillmentService GraphQL mutation.

Solution

GetFulfillmentService: Split the JSON parsing into two steps. First resolve data.location — if it's null (location no longer exists in Shopify), delete the stale ShopLocation record (which cascades to related Shpfy Shop Inventory records) and exit. Then separately resolve fulfillmentService within the location object.

UpdateFulfillmentServiceCallbackUrl: After calling GetFulfillmentService, recheck Fulfillment Service Id. If it's still 0 (record was deleted or service couldn't be resolved), exit before attempting the update mutation. This provides defense in depth against calling the Shopify API with an invalid ID.

Fixes AB#622988

@onbuyuka onbuyuka requested a review from a team as a code owner February 25, 2026 10:30
@onbuyuka onbuyuka enabled auto-merge (squash) February 25, 2026 10:31
@github-actions github-actions bot added the AL: Apps (W1) Add-on apps for W1 label Feb 25, 2026
@github-actions github-actions bot added this to the Version 29.0 milestone Feb 25, 2026
@onbuyuka onbuyuka merged commit 1819203 into main Feb 26, 2026
39 checks passed
@onbuyuka onbuyuka deleted the bugs/622988-ShpfyFulfillmentSvcUpdate branch February 26, 2026 09:37
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