-
I've been recently trying to use GraphQL and wanted to refactor the methods inside the query_type. However, I encountered an error, and despite trying various methods, I couldn't successfully extract them. I also haven't duplicated the use of mutations. Why is this error occurring? Here is my code.
I apologize once again, as I couldn't make further attempts due to the lack of clarity about the root cause of the issue. I'm sorry for taking up your time. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi! Sorry for the trouble. Yes, that's very strange. My first guess is that, somehow, # app/graphql/test_for_graphql_schema.rb
class TestForGraphqlSchema < GraphQL::Schema
puts "Loading #{self}"
mutation(Types::MutationType) |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Thanks for sharing -- I wouldn't be surprised if some of those other error messages are really the underlying cause. For example, Rails might start loading the schema
.rb
file, but then encounter an error part-way through and stop loading it. In that case, it would be partially loaded: the schema class would be defined, but since Rails didn't finish loading it, then Rails would try again, causing this error.I suggest stopping the development server, then starting it again (to make sure that nothing is loaded yet), then replicating this error. After that, scroll back to the start of the server logs and find the first error message. Hopefully addressing that error will make things work bet…