Open DigNZ opened 1 month ago
The token limit of 5000 is a security precaution to not allow malicious actors to overwhelm your server.
It is configurable, however, see https://docs.directus.io/self-hosted/config-options.html#limits-optimizations and more specifically the GRAPHQL_QUERY_TOKEN_LIMIT
option.
Still, a query that large for the situation you described sounds like there might be some room for optimization, that's why I'm leaving this open.
Thanks, I might need it as a work around, I'm more curious as to why the error is triggered on saving an edit, but not when using the dashboards normally. - Seems like an edit triggers other queries from other pages that may not be necessary.
Describe the Bug
Our implementation has a lot of dashboards (around 30) each containing a number of panels (around 6-8 each). There are some global variables that are shared between all the dashboards so that for example a time range can be specified on any dashboard and they are kept in sync.
When editing some dashboard, on save, we'll get a 'GraphQL error' popup, the dev tools show this response:
However refreshing the page or normal use of the dashboard never triggers this error. Looking at the request it appears to be running queries for all sorts of collections and filters that are not on the dashboard that is currently being edited - the queries are not in the graphql payload except after saving an edit. They push it over the limit and cause the error. Not all dashboards are affected, there are others that can still be edited. I think global variables are related to this but haven't pinned it down.
To Reproduce
Create a number of dashboards with a lot of panels on each. Include shared global variables and shared global relational variables across the dashboard. Note that the request to graphql endpoint is larger when saving an edit compared to using the dashboard without editing. Note that it includes filters or queries from dashboards other than the one being edited. When they get to a certain threshold they cause the graphSQL error.
Directus Version
v11.0.0
Hosting Strategy
Self-Hosted (Docker Image)
Database
PostgreSQL