Comments (9)
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.
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.
@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.
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.
Do you have the JWT_TOKEN
in the .env?
from graphiql-rails.
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.
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.
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.
JsoN Parson error: Unexpected token:<
Plz sove this error
from graphiql-rails.
Related Issues (20)
- der
- Graphql query execute is getting freeze from model callbacks HOT 1
- Build issue when bumping graphiql-rails from 1.8.0 to 1.9.0 HOT 7
- doesn't work with propshaft HOT 2
- Current GraphiQL version not compatible with graphql-ruby 1.9.x HOT 4
- conditionally render route HOT 6
- onEditQuery is undefined HOT 1
- AbstractController::ActionNotFound (The action 'execute' could not be found for GraphqlController): HOT 1
- AssetNotPrecompiled error with Sprockets 4.0 HOT 27
- How to use this gem with graphql subscription? HOT 1
- default context variables HOT 1
- GraphiQL::Rails::EditorsController#show raising on new Rails 6 app HOT 3
- Question about request header configuration with initializer HOT 1
- Using GraphiQL in your Rails app without this gem HOT 7
- uninitialized constant GraphqlController::GraphQLIntroSchema Did you mean? GraphQlIntroSchema HOT 1
- Is this gem dead? HOT 1
- Support for subscriptions HOT 3
- headerEditorEnabled config HOT 1
- sass not needed anymore? HOT 2
- Your application has sessions disabled HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphiql-rails.