Comments (40)
I'm afraid however that the new flavor mechanism is not enough yet. I'm trying to make a client for graphcool. Please be patient, I might have something later this week
from aor-simple-graphql-client.
Inspecting the network tab when using graphiql, the initial introspection query does not return anything for the queries and mutations, however I still get the correct queries and mutations in the generated docs, which is weird.
I now have a doubt and am going to play around with my server.
from aor-simple-graphql-client.
- Have you tried without passing introspection options at all (if they are the same as the defaults one) ?
- In your network tab, can you check that your server does returns your queries and mutations as the response of the introspection query ?
- What are you using for your graphql server ?
from aor-simple-graphql-client.
- Yes I had previously tried without the introspectionOptions which resulted in the same error.
- As mentionned above, I am not receiving my queries nor mutations from my graphql server
as you can see, I am receiving my schema types and input-types
I am using graphql on node.js with graphql-server-express
from aor-simple-graphql-client.
Well, this is very strange indeed. What versions of graphql-server-express
are you using ?
from aor-simple-graphql-client.
"graphql-server-express": "^0.6.0",
from aor-simple-graphql-client.
I don't know then, we are using the "standard" introspectionQuery
from the graphql
package so, if neither the queries nor the mutations are in the response, you should double check your schema. It has to be a problem on the server side.
from aor-simple-graphql-client.
Can you share your schema ? Part of it at least (declarations of the queries and mutations without their content) ?
from aor-simple-graphql-client.
from aor-simple-graphql-client.
the problem is definitely not on the server.
Is there something else to be done to configure the appollo client ?
i see there is an option to configure our own queries, from the Readme :
const queries = {
Post: {
GET_LIST: () => gql`your query`, // Variables will be: { page: Int, perPage: Int, sortFilter: String, sortOrder: String, filter: String }
GET_MANY: () => gql`your query`, // Optional, see note below. Variables will be: { filter: String }
GET_MANY_REFERENCE: () => gql`your query`, // Optional, see note below. Variables will be: { filter: String }
GET_ONE: () => gql`your query`, // Variables will be: { id: ID }
CREATE: () => gql`your query`, // Variables will be: { data: String }
UPDATE: () => gql`your query`, // Variables will be: { data: String }
DELETE: () => gql`your query`, // Variables will be: { id: ID }
}
}
however its unclear how to include this in the appollo client.
I will share our schema decleration if you still think it will help
from aor-simple-graphql-client.
No you shouldn't have anything to configure on the apollo client.
About the queries
option, simply pass it to the buildApolloClient
as you do with clientOptions
and introspection
.
from aor-simple-graphql-client.
this is how we build our schema
const rootSchema = `
type Query {
${favoriteQueries}
${userQueries}
${propertyQueries}
${purchaseQueries}
${servicePackQueries}
${conversationQueries}
}
type Mutation {
${favoriteMutations}
${userMutations}
${propertyMutations}
${purchaseMutations}
${servicePackMutations}
${conversationMutations}
}
schema {
query: Query
mutation: Mutation
}
`
// Put schema together into one array of schema strings
// and one map of resolvers, like makeExecutableSchema expects
const schema = [rootSchema, favoriteTypes, userTypes, propertyTypes, purchaseTypes, servicePackTypes, conversationTypes]
const resolvers = merge(favoriteResolvers, userResolvers, propertyResolvers, purchaseResolvers, servicePackResolvers,
conversationResolvers)
const executableSchema = makeExecutableSchema({
typeDefs: schema,
resolvers
})
export default executableSchema
When I try the introspection by hand in graphiql, I get the same result :
I can get my types but not the queries.
However, the introspection query the GraphiQL does manages to get this information, as it is present in GraphiQL schema Docs . . .
from aor-simple-graphql-client.
The introspection query is actually a little more complicated, that's why we use the official one: https://github.com/graphql/graphql-js/blob/master/src/utilities/introspectionQuery.js
from aor-simple-graphql-client.
Even with the query that you linked to, I don't receive my queries and mutation, but with the following query I do:
__schema {
queryType {
name
fields {
name
description
type {
name
kind
}
args {
name
type {
name
kind
ofType {
name
kind
}
}
}
}
}
}
... Is this approach deprecated ?
from aor-simple-graphql-client.
You mean you tried this query in graphiql and didn't receive the expected data ?
from aor-simple-graphql-client.
Result using the official introspection query you linked to :
Result using the query I pasted above
from aor-simple-graphql-client.
The strange thing is that aor-simple-graphql-client
use the official introspection query as you can see here
from aor-simple-graphql-client.
oh wait, misread...
from aor-simple-graphql-client.
This is really really weird. I use this package as is, without special configuration on a projet of mine and it works.
from aor-simple-graphql-client.
I'm using the graphql-server-koa
package on server side though.
from aor-simple-graphql-client.
And you can see here that this is the query used by graphiql too
from aor-simple-graphql-client.
Please do explain what happened when you find it
from aor-simple-graphql-client.
looking more closely at the introspection comparison screenshots, it looks like the "official" introspection query is getting my queries and mutations, but as part of types
instead of queryType
, and somehow graphiQL can manage this kind of response.
from aor-simple-graphql-client.
It's not the server, whatever I try ends up in a Graphql Error, Its got to be the introspection query.
Perhaps graphiQL has other ways of getting information about the queries and mutations if they are not present in queryType
& mutationType
of the introspection response?
from aor-simple-graphql-client.
Maybe but I fail to see why your queries and mutations aren't in queryType and mutationType if you're using apollo server for express
from aor-simple-graphql-client.
The only difference I see between your project and mine is that I use extend Query
to separate my queries in different files when you "concatenate" your queries. But this should not impact the way the schema is built
from aor-simple-graphql-client.
For now, I will make do with our in-house graphql-rest-client for AOR.
I want to explore this further however when I have the time
from aor-simple-graphql-client.
Np: FIY my project using aor and this client is https://github.com/djhi/dpc
from aor-simple-graphql-client.
Hi,
So I have begun a side project, using Graph Cool as my graphQL backend
And i'm having the exact same issue.
Below you see that nothing is returned in the query
part of the response
However, below, you can see in the Appollo dev tools that GraphiQL has no problem getting this information.
I invite you to try out a sample schema on Graph Cool to see for youself.
The only conclusion I draw from this is that something is missing from the introspection query used in this package . . .
from aor-simple-graphql-client.
check my changes in #25
let me know if need help
from aor-simple-graphql-client.
@mulyoved
thanks . . . But i'm confused, what's the hack I'm looking at ?
from aor-simple-graphql-client.
This is a fork that adjusts the introspection to fit graph.cool
from aor-simple-graphql-client.
I understand, But I don't see what the adjustment is.
from aor-simple-graphql-client.
check https://github.com/marmelab/aor-simple-graphql-client/pull/25/files
will see changes made to make it work with graph.cool
from aor-simple-graphql-client.
This client is not compatible with graphcool which requires a very different introspection analysis and does not handle pagination as we do here. Please use @mulyoved version for graphcool
from aor-simple-graphql-client.
@mulyoved I'm using aor-graph-cool-client
and still get the error as this issue. Couldn't create an issue in that repo, please help.
import React, { Component } from 'react';
import { simpleRestClient, Admin, Resource } from 'admin-on-rest';
import { buildApolloClient } from 'aor-graph-cool-client';
import { PostList, PostEdit, PostCreate, PostIcon } from './posts';
import { ApolloClient, createNetworkInterface } from 'apollo-client';
class AdminPage extends Component {
constructor() {
super();
this.state = { restClient: null };
}
componentDidMount() {
const client = new ApolloClient({
networkInterface: createNetworkInterface({
uri: 'https://api.graph.cool/simple/v1/cxx'
})
});
buildApolloClient({client})
.then(restClient => this.setState({ restClient }));
}
render() {
const { restClient } = this.state;
if (!restClient) {
return <div>Loading</div>;
}
return (
<Admin restClient={restClient}>
<Resource name="Post" list={PostList} edit={PostEdit} create={PostCreate} />
</Admin>
);
}
}
export default AdminPage
from aor-simple-graphql-client.
@vysakh0 aor-graph-cool-client is deprecated by the addition of GraphQL flavor, see https://github.com/marmelab/aor-simple-graphql-client
from aor-simple-graphql-client.
@djhi Cool, thank you! 👍
from aor-simple-graphql-client.
@djhi Is there absolutely NO way to currently hook up aor-simple-graphql-client to graph.cool? Even with the queries
and/or flavor
objects? I would appreciate if someone has come up with a temporary workaround until the graphcool client comes out.
I've been desperately trying to get this to work for two days now, but docs on this project, as well as @mulyoved's aor-graph-cool-client docs lead you in circles and ultimately to a dead end... :). Maybe the READMEs should be updated.
from aor-simple-graphql-client.
Hi there, see #40 :) In a nutshell, I'm working on a new cleaner client.
from aor-simple-graphql-client.
Related Issues (20)
- Supply your own queries and mutations confusion HOT 2
- Support for subfields HOT 2
- Ensure we throw an understandable error when introspection fails
- Clarifies usage of custom queries in README
- [RFC] Extract realtime saga in its own package HOT 2
- Handle embedded objects and relations
- Ability to really configure the apollo realtime mechanisms
- [RFC] Make implementing different flavors of graphql easier
- Explore how subscriptions could be used for real time updates
- RangeError: Maximum call stack size exceeded HOT 3
- [RFC] Complete rewrite and deprecation HOT 13
- listQueriesFromSchemaFactory undefined HOT 1
- No introspection data for resources issue HOT 2
- incompatible with current version of admin-on-rest HOT 1
- Ressource List use only the last element HOT 7
- Error with variables during mutation HOT 2
- Documentation issues regarding GraphCool HOT 1
- Graphcool compatibility HOT 3
- Use edges and node for pagination
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 aor-simple-graphql-client.