Graphql query deletionEvents not working

Solved

Graphql query deletionEvents not working

shopyapp
Shopify Partner
7 1 1

Hello,

Using simple query deletionEvents receive Internal Error:

 

Query

{
deletionEvents(first: 20) {
nodes {
occurredAt
subjectId
subjectType
}
}
}

 

 

Response:

 

{
"errors": [
{
"message": "Internal error. Looks like something went wrong on our end.\nRequest ID: 46973223-ac0a-4e3d-ac57-15258ccb2141 (include this in support requests).",
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"requestId": "46973223-ac0a-4e3d-ac57-15258ccb2141"
}
}
]
}

 

Any API version.

https://shopify.dev/docs/api/admin-graphql/2023-04/queries/deletionEvents

Accepted Solution (1)
ShopifyDevSup
Shopify Staff
1453 238 508

This is an accepted solution.

Hi @shopyapp 👋

 

Thanks for flagging this! 

 

We've brought it to the product team, and for now setting the `subjectTypes` parameter explicitly to `PRODUCT` or `COLLECTION` should return the deletion events.  Would you please try `deletionEvents(first: 10, subjectTypes:PRODUCT)` or `deletionEvents(first: 10, subjectTypes:COLLECTION)`? 

 

 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 5 (5)

Liam
Community Manager
3108 340 871

Hi Shopyapp,

 

It does sound like this is not an issue with your app, but something within Shopify - are you continuously getting this error, or is it happening sporadically? One thing you could test would be if you can make a different but related event query, like webhookSubscription. I'll also check internally if there are other reports of this query failing. 

 

Hope this helps,

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

shopyapp
Shopify Partner
7 1 1

Hello,

 

The issue is related only to deletionEvents query. It always fail with the same INTERNAL_SERVER_ERROR message. We never seen a correct answer for this query so far in any API version.

 

All the other queries are working fine (inlcuding webhookSubscription). We are using Shopify GraphiQL App for testing on several stores and the same problem is for all, including Shopify Plus subscription.

 

Are you able to see a non error message to deletionEvents query call with your testing tools?

 

Thank you

ShopifyDevSup
Shopify Staff
1453 238 508

This is an accepted solution.

Hi @shopyapp 👋

 

Thanks for flagging this! 

 

We've brought it to the product team, and for now setting the `subjectTypes` parameter explicitly to `PRODUCT` or `COLLECTION` should return the deletion events.  Would you please try `deletionEvents(first: 10, subjectTypes:PRODUCT)` or `deletionEvents(first: 10, subjectTypes:COLLECTION)`? 

 

 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

shopyapp
Shopify Partner
7 1 1

Hello,

 

Running the query by specifying subjectTypes will workaround the internal error:

{
deletionEvents(first: 2, subjectTypes:PRODUCT) {
nodes {
occurredAt
subjectId
subjectType
}
}
}

 

will produce a nice result:

{
"data": {
"deletionEvents": {
"nodes": [
{
"occurredAt": "2021-03-09T09:20:51Z",
"subjectId": "gid://shopify/Product/6...9",
"subjectType": "PRODUCT"
},
{
"occurredAt": "2021-03-09T09:45:00Z",
"subjectId": "gid://shopify/Product/6...1",
"subjectType": "PRODUCT"
}
]
}
},
"extensions": {
...
}
}
}

 

 

This could be an accepted solution for the initial problem.

 

 

In order to help community and keep the deletionEvents query in same open spirit as webhookSubscription and bulkOperationRunQuery, we are proposing that you keep current behavior of deletionEvents query to return all deleted Global IDs (available based on app permissions scope) and extend DeletionEventSubjectType enumeration with all object types defined by Global IDs coverage like: CUSTOMER, ORDER, etc.

 

See the full list bellow:

https://shopify.dev/docs/api/usage/gids

 

We hope you will quick insert this enumeration extension in unstable api version so we can benefit from it.

 

Thank you

ShopifyDevSup
Shopify Staff
1453 238 508

Thanks for trying the added parameter! We'll be sure to let the product teams know how valuable it would be for deletion events to be accessible for all node objects. In the meantime, many core objects (including `Order` and `Customer`) have a dedicated `delete` event as an option for webhooks. 

 

 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog