Skip to content

[5.x]: GraphiQL erroring and won't load so can't resolve #16887

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

Open
JayBox325 opened this issue Mar 13, 2025 · 4 comments
Open

[5.x]: GraphiQL erroring and won't load so can't resolve #16887

JayBox325 opened this issue Mar 13, 2025 · 4 comments
Labels

Comments

@JayBox325
Copy link
Contributor

What happened?

Description

When I try to open the GraphiQL playground, it never loads, but has these errors in the logs. It works in an incognito window, but still won't when I clear the cache and hard reload.

Image

Steps to reproduce

  1. Not sure, it just stopped working.

Craft CMS version

5.6.11

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

@JayBox325 JayBox325 added the bug label Mar 13, 2025
@krafttoast
Copy link

Same problem in Craft Pro 4.14.11.

Image

Clearing Cache won't resolve it.

Incognito Mode throws also an Error when loading a Schema:

Image

Looking into 'storage/logs/phperrors.log' it seems the whole process crashes out of memory:

[26-Mar-2025 12:09:13 Europe/Vienna] PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in /var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php on line 1194

[26-Mar-2025 12:09:13 Europe/Vienna] PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 221184 bytes) in /var/www/html/vendor/yiisoft/yii2-debug/src/LogTarget.php on line 66

[26-Mar-2025 12:09:24 Europe/Vienna] PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in /var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php on line 1194

[26-Mar-2025 12:09:24 Europe/Vienna] PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 200704 bytes) in /var/www/html/vendor/yiisoft/yii2-debug/src/LogTarget.php on line 66

Sometimes its from another location:

[15-Jan-2025 10:48:15 Europe/Vienna] PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in /var/www/html/vendor/yiisoft/yii2/helpers/BaseJson.php on line 224

[07-Feb-2025 11:41:09 Europe/Vienna] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /var/www/html/vendor/webonyx/graphql-php/src/Type/Definition/FieldArgument.php on line 71

Regarding memory I'm running a DDEV instance with 1GB of allowed Memory.

@brandonkelly
Copy link
Member

Sounds like this is the same root issue as #15068 – that GraphQL schemas have a tendency to grow very large.

@JayBox325 In your case, it sounds like GraphiQL (or some aspect of your hosting infrastructure) is timing out, causing the initial syntax error, but then the PHP process does end up continuing and finishing generating the schema and caching it, which is why it works correctly on subsequent requests (until you clear caches).

@krafttoast Either your schema is extremely large, or there’s some sort of infinite recursion bug going on.

Try enabling safeMode and see if that helps. If so, maybe a module/plugin is affecting this. Otherwise, try doubling the size of your memory.

@krafttoast
Copy link

@brandonkelly running Craft in safeMode did not resolve the issue, but doubling the size of memory and running GraphiQL in incognito mode did.

The schema is indeed very large, since the Craftsetup contains 2 sites with each 60 sections, every section contains ~4 entrytypes, each entrytype has an average of 30 Fields. GraphQL at some point loads the whole AST of the schema which is where it mostly runs OOM. For developement purposes I guess it's fine to just up the memory.

@brandonkelly
Copy link
Member

Yeah unfortunately, GraphiQL loads the entire introspection schema, which means every possible field/argument/type needs to be built out at once. Good news is that it doesn’t affect actual GrapphQL queries, which will only build out the parts of the schema that are actually involved in the query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants