Products connection query date filter suddenly getting INTERNAL_SERVER_ERROR

Solved

Products connection query date filter suddenly getting INTERNAL_SERVER_ERROR

DanAtBonify
Shopify Partner
57 4 40

We are suddenly running into INTERNAL_SERVER_ERROR responses for Products queries that use a date search filter, and where the filter value is wrapped in single quotes.

 

Example:

{
  products(first: 10, query: "created_at:<'2023-12-12T13:23:28+0000'") {
    edges {
      node {
        title
      }
    }
  }
}

 

 

Response:

{
  "errors": [
    {
      "message": "Internal error. Looks like something went wrong on our end.\nRequest ID: c36757d9-8484-41c0-bcaf-10a1eb71e2b1 (include this in support requests).",
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "requestId": "c36757d9-8484-41c0-bcaf-10a1eb71e2b1"
      }
    }
  ]
}

 

Interestingly, other connection types, like customers and orders, the date filter continues to work whether the value is wrapped in quotes or not.

 

If I remove the quotes from the date filter it works. But I am not sure why the syntax is suddenly breaking (within past day or two), and to make it even more confusing, why the issue appears to be specific to products query.

 

 

 

 

Accepted Solution (1)
DanAtBonify
Shopify Partner
57 4 40

This is an accepted solution.

OKAY, might have found my issue.

created_at:>'2023-02-24T16:51:09+00:00' (works)
vs.
created_at:>'2023-02-24T16:51:09+0000' (errors)

 

Turns out the date library I was using was not formatting the timezone offset properly for ISO8601 dates. "+0000" instead of "00:00".

 

Using "00:00" works as expected.

View solution in original post

Replies 5 (5)

Liam
Community Manager
3108 341 879

Hi Dan,

 

Our docs don't have any examples of `created_at` for product queries, but there is one that uses `updated_at` which is formatted like:

products(first: 10, query: "updated_at:>2019-12-01")

without any single quotes, and it should follow that `created_at` would use the same syntax pattern. Can you update your app to follow this pattern? It's possible the date filter with single quotes was not intended to be working. Other resources like customers should also use the "updated_at:>2019-12-01" format too - according to our docs. 

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

DanAtBonify
Shopify Partner
57 4 40

Ok thank you. We'll make the change and monitor!

DanAtBonify
Shopify Partner
57 4 40

Well, it appears that the issue may be more specific to dates with times. 

 

When running a query against orders, based on a specific time..

 

This works correctly:

created_at:>'2023-12-12T22:45:00+0000' AND created_at:<'2023-12-14T22:30:00+0000'

 

This does not return correct orders (no quotes):

created_at:>2023-12-12T22:45:00+0000 AND created_at:<2023-12-14T22:30:00+0000

 

But of course, for products, the query with quotes that should work correctly is getting an INTERNAL_SERVER_ERROR..

 

So.... should this actually work for products? or is there a different/correct way to use date filters that include time and timezone?

 

I want to also re-emphasize that the reported issue related to product query just suddenly stopped working. We have customers who have had automations running for months without issue...

DanAtBonify
Shopify Partner
57 4 40

This is an accepted solution.

OKAY, might have found my issue.

created_at:>'2023-02-24T16:51:09+00:00' (works)
vs.
created_at:>'2023-02-24T16:51:09+0000' (errors)

 

Turns out the date library I was using was not formatting the timezone offset properly for ISO8601 dates. "+0000" instead of "00:00".

 

Using "00:00" works as expected.

Liam
Community Manager
3108 341 879

Hi Dan,

 

That would make sense - thanks for coming back to post this solution.

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