graphql-ruby: Mutations not being loaded
Hello community,
I’m reaching to this section as I have been working on several weeks to understand whether this is potentially a bug.
The piece of code below regards to a login mutation. It takes email and password, then ruby-graphql should return a token. The actual values for email and password are passed as variables.
mutation {
token: login(
email: "...",
password: "..."
)
}
In production environment GraphQL spills an odd error regarding mutations not being configured.
{
"errors": [
{
"message": "Schema is not configured for mutations",
"locations": [
{
"line": 1,
"column": 1
}
],
"path": [
"mutation"
],
"extensions": {
"code": "missingMutationConfiguration"
}
}
],
"extensions": {}
}
Any ideas?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (7 by maintainers)
@cassiopagnoncelli sorry to hear that you have to redo the schema from scratch. Well at least the problem’s gone 😃
I’m going to close the issue, if you bump into some issue like this 🤞 in the future and discover a gotcha, be glad to take a PR to document it.
@nekogami No not really, turns out that the query and mutation are well-formed, it actually returns a value, look:
I just run it in my machine under Docker on development environment. When I deploy to production, mutations won’t work.
Types::QueryTypeis recognized and queries work perfectly, but not forTypes::MutationTypeas they aren’t even loaded.I’m trying to think what could be different in development vs. production. One thing that stood out is parallelism – are you using a multi-threaded or multiprocess server like Puma or Phusion Passenger? I wonder if a process could somehow fork before the schema is totally booted, and then the forked schema isn’t all set up properly.
I don’t really have a clear suggestion, except something that sometimes helps with these loading issues. Try adding at the very bottom of
api_schema.rb:It might work 😅 . (Longer term, I’m trying to simplify schema boot over at #2363.)
Hey @cassiopagnoncelli I like to help but need more information about your schema setup. Specifically the call site where you have
And your equivalent of
Types::MutationTypeclass.From the error, it looks like it might be broken right at the Schema def level.