Closed marcnjaramillo closed 4 years ago
Hi @marcnjaramillo, thank you for the feedback!
I've tried to reproduce the issue locally and for some reason sign in works for me (I've just cloned the repo, no any local changes at all). There is a chance that the code in the guide is different from this repo (and we need to figure that out), could you please share what you have in your sign_in_mutation.rb
?
In the implementation provided in this repo we have only one plain argument email
, it's not wrapped with the input:
module Mutations
class SignInMutation < Mutations::BaseMutation
argument :email, String, required: true
...
Hi Dimitry,
I think I just found the issue. I glazed over it (spent too much time staring at lines of code), but just spotted it clear as day.
When I ran rails generate graphql:install
, my base_mutation.rb
looks like this:
module Mutations
class BaseMutation < GraphQL::Schema::RelayClassicMutation
argument_class Types::BaseArgument
field_class Types::BaseField
input_object_class Types::BaseInputObject
object_class Types::BaseObject
end
end
while the same file in the tutorial repo looks like this:
module Mutations
class BaseMutation < GraphQL::Schema::Mutation
end
end
Further, in my /types
there are three files that have code that the tutorial repo does not:
// base_field.rb
module Types
class BaseField < GraphQL::Schema::Field
argument_class Types::BaseArgument
end
end
// base_input_object.rb
module Types
class BaseInputObject < GraphQL::Schema::InputObject
argument_class Types::BaseArgument
end
end
// base_object.rb
module Types
class BaseObject < GraphQL::Schema::Object
field_class Types::BaseField
end
end
I have no idea why my installation yielded such different results...my version of graphql
in the Gemfile.lock
matches that of the tutorial. My ruby
version is 2.6.2, but I can't imagine that playing a role in it. Any ideas?
I think I've figured it out! At the moment when the second part of the tutorial was released, generator did not include the base_mutation
at all (and in the tutorial we ask to create it manually). However, at the end of the October, base_mutation was added to the generator.
I'll update the article in a few days, thank you for catching that! I think that other generated classes should not affect the tutorial in any ways, but please let me know if you find something (or just freeze the graphql-ruby version, it was 1.19.6 at the moment of the tutorial release).
It can be so hard to keep up with all of the changes that happen all the time. So many other tutorials have broken code and aren't maintained, which I get. Thanks for making the time for this!
We've updated the article, so I'm closing this PR, thanks again!
Hello,
First of all, I am really enjoying this tutorial. It's easy to read and follow, and having the complete repo as a reference is very helpful. While working through Part 2, I ran into an issue with the
signIn
mutation. I followed along and implemented everything correctly, but I kept seeing this error:It took me a few hours, and I finally went into GraphiQL (this is my first time using GraphQL, so the tools are new to me) to test out the mutation. I noticed that
signIn(email:
on the second line was underlined in red. I hovered over and saw these two messages:Field "signIn" argument "input" of type "SignInMutationInput!" is required but not provided."
(signIn),Unknown argument "email" on field "signIn" of type "Mutation".
(email:).I changed line 2 as you can see in the PR, and the error message went away. I went back into the development app and tried it out and it worked.
I hope this helps!