A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
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.
Solved! Go to the solution
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.
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
Ok thank you. We'll make the change and monitor!
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...
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.
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