Problem/Motivation
After updating to 5.0.0-alpha3, I get a lot of errors like this in the logs:
Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException: Failed to read schema file "modules/custom/MY_MODULE/graphql/base.extension.graphqls". in Drupal\graphql\Plugin\GraphQL\SchemaExtension\SdlSchemaExtensionPluginBase->loadDefinitionFile() (line 111 of .../web/modules/contrib/graphql/src/Plugin/GraphQL/SchemaExtension/SdlSchemaExtensionPluginBase.php).
Steps to reproduce
The MY_MODULE/graphql/base.extension.graphqls file is an empty file.
I don't know if there are any actual visible failures, but the errors are worrying so I'm reverting the update for now.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | message.PNG | 3.58 KB | angel_devoeted |
Issue fork graphql-3587476
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
kingdutchThanks for the report! This is an intentional change due to the adoption of
Sourceinstances with source location information for better debugging. Unfortunately it does not support empty strings, so this is a behaviour change.I've pushed a fix to clarify the exception being thrown and show this is intentional, I've also added a change record to the original issue (and linked it to this one) to better clarify this change and provide the proposed solution.
Comment #5
angel_devoeted commentedTested
MR !90on Drupal Forge and confirmed it works as expected. Empty schema files now trigger a clearInvalidPluginDefinitionExceptionwith the specific message, instead of a generic failure.Comment #6
solideogloria commentedComment #7
kingdutchComment #10
klausiUnfortunately this breaks our use case, so we will have to revert parts of this.
A graphql extension module can have an extension definition, but not a base definition.
Example:
jobiqo_analytics.base.graphqls: empty or should not exist
jobiqo_analytics.extension.graphqls: contains extensions like
Proposed solution: allow empty and missing *.graphqls files.
Comment #12
klausiMR created, if you are ok with the approach I can add a test case.
Comment #13
klausiSorry, I should have a read the change notice ...
So that should also work for us, hopefully not too many schema extension classes to update.
Setting this back to fixed for now.