Giter VIP home page Giter VIP logo

Comments (9)

rmosolgo avatar rmosolgo commented on July 18, 2024

Yeah, mine does this when the server responds with 500. Is there a clue in your Rails log as to what the error was (/is) ?

Also, can you check the Chrome Devtools "network" tab, do you see any error responses there?

from graphiql-rails.

NicholasLYang avatar NicholasLYang commented on July 18, 2024

That's a good call. I'm getting an ArgumentError (wrong number of arguments (given 1, expected 0)): in my landbnb_schema.rb. My schema is the following:

LandbnbSchema = GraphQL::Schema.define do
#  mutation(Types::MutationType)
  query(Types::QueryType)
end

The mutation is commented out because I haven't implemented it yet

from graphiql-rails.

mikeLspohn avatar mikeLspohn commented on July 18, 2024

@NicholasLYang Any luck solving this?

I'm getting same thing. This is from my devtools console

Warning: Failed prop type: VariableEditor: prop type readOnly is invalid; it must be a function, usually from React.PropTypes.
in VariableEditor (created by GraphiQL)
in GraphiQL

from graphiql-rails.

Dbz avatar Dbz commented on July 18, 2024

I'm getting a similar error when receiving a 500 internal server error (404 Record Not Found). I posted a Stack Overflow question about this containing my code:

https://stackoverflow.com/questions/47095362/graphql-exception-handling-not-catching-exceptions

I think this may be a bug. I even have exception handling, and it ignores it. However, in other cases it does not ignore the exception handling.

from graphiql-rails.

shoan avatar shoan commented on July 18, 2024

Do you have the JWT_TOKEN in the .env?

from graphiql-rails.

sampahcoding avatar sampahcoding commented on July 18, 2024

I got the same problem, this error appear ArgumentError (wrong number of arguments (given 1, expected 0)): when the code hit the following(line 2):

Schema = GraphQL::Schema.define do
  query Query
end

Turns out I just need to import all the the Query schema (which is Query on above code) and all related data types like below:

#app/graphql/queries.rb
Query = GraphQL::ObjectType.define do
  name 'Query'

  field :allProfiles, !types[ProfileType] do
    description 'Get all xxxx'
    resolve ->(_obj, args, _ctx) {
     # calling datas
    }
  end
end
require_relative 'queries'

Schema = GraphQL::Schema.define do
  query Query
end

from graphiql-rails.

ConorSheehan1 avatar ConorSheehan1 commented on July 18, 2024

Finally got to the bottom of this.

In the tutorial they use DateTimeType in link_type.rb but it's undefined.

Seems the DateTimeType has been a source of confusion for a while.
https://stackoverflow.com/questions/47960194/graphql-ruby-date-or-datetime-type
rmosolgo/graphql-ruby-demo#27

You could define DateTimeType in app/graphql/types/date_time_type.rb
or comment out the created_at field.

# app/graphql/types/date_time_type.rb
module Types
  class DateTimeType < GraphQL::Schema::Scalar
    def self.coerce_input(value, _context)
      Time.zone.parse(value)
    end

    def self.coerce_result(value, _context)
      value.utc.iso8601
    end
  end
end

Edit: DateTimeType inherits from BaseScalar which is also a custom type. You can either add BaseScalar to app/graphql/types/base_scalar.rb or just replace it with GraphQL::Schema::Scalar in date_time_type.rb since BaseScalar is empty and just inherits from GraphQL::Schema::Scalar anyway.

Also, it seems graphiql will raise that error in almost all cases. I managed to figure this out by looking at the rails output and logs.

from graphiql-rails.

 avatar commented on July 18, 2024

I was getting this error as well. It turns out the JSON error was the result of a trailing comma in my User model:

Issue:

app/models/user.rb (or relevant model)

class User < ApplicationRecord
  has_secure_password

  validates :name, presence: true
  validates :email, presence: true, uniqueness: true,
end

Solution:

Remove the trailing comma, so email validation should be:

  validates :email, presence: true, uniqueness: true

I realize it's an old issue but hopefully it helps someone following my search trail :)

from graphiql-rails.

Honeyzed avatar Honeyzed commented on July 18, 2024

JsoN Parson error: Unexpected token:<
Plz sove this error

from graphiql-rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.