Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Article] Related articles throw errors when main article has too much tags #30

Open
GemN opened this issue Sep 15, 2022 · 0 comments · May be fixed by #35
Open

[Article] Related articles throw errors when main article has too much tags #30

GemN opened this issue Sep 15, 2022 · 0 comments · May be fixed by #35
Assignees

Comments

@GemN
Copy link
Contributor

GemN commented Sep 15, 2022

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)

@louisholley louisholley linked a pull request Jan 31, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant