-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
How to reproduce
(prod env)
query {
article(id: 459) {
id
slug
relatedArticles(take: 4) {
id
slug
}
}
}
Description
When querying the API for an article with a huge amount of tags, it throws:
message: 'Unexpected error value: { name: "ApiError", message: "Invalid value for \\"query\\" parameter, expected string shorter than 512 bytes", status: 400, transporterStackTrace: [[Object]] }',
After investigating, related articles build a huge query based on the tags which throws when over than 512bytes.
query = await articleQueryFilter(
query,
{
searchQuery_eq: article.title + " " + article.tags.join(" ")
},
sort,
)
Proposed solution
We started to discuss on discord limiting the amount of tags, and add an order of importance which could be a solution but meanwhile from a pure technical POV:
- We can iterate over tags, check the tag length, adding it to the query if the query is < 512 bytes with the new tag.
To note that even if we limit the number of tags, we should aways check that the query is under 512 bytes to avoid errors since it's completely dynamic and based on the title name (no size limit at the moment) and tags (not individual size limit)
Metadata
Metadata
Assignees
Labels
No labels