GithubHelp home page GithubHelp logo

Comments (40)

djhi avatar djhi commented on May 3, 2024 2

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.

Thebigbignooby avatar Thebigbignooby commented on May 3, 2024 1

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.

djhi avatar djhi commented on May 3, 2024
  • 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.

Thebigbignooby avatar Thebigbignooby commented on May 3, 2024
  • 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

gql-introspection-data

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.

djhi avatar djhi commented on May 3, 2024

Well, this is very strange indeed. What versions of graphql-server-express are you using ?

from aor-simple-graphql-client.

Thebigbignooby avatar Thebigbignooby commented on May 3, 2024

"graphql-server-express": "^0.6.0",

from aor-simple-graphql-client.

djhi avatar djhi commented on May 3, 2024

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.

djhi avatar djhi commented on May 3, 2024

Can you share your schema ? Part of it at least (declarations of the queries and mutations without their content) ?

from aor-simple-graphql-client.

Thebigbignooby avatar Thebigbignooby commented on May 3, 2024

from aor-simple-graphql-client.

Thebigbignooby avatar Thebigbignooby commented on May 3, 2024

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.

djhi avatar djhi commented on May 3, 2024

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.

Thebigbignooby avatar Thebigbignooby commented on May 3, 2024

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 :
graphiql-introspection-test

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.

djhi avatar djhi commented on May 3, 2024

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.

Thebigbignooby avatar Thebigbignooby commented on May 3, 2024

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.

djhi avatar djhi commented on May 3, 2024

You mean you tried this query in graphiql and didn't receive the expected data ?

from aor-simple-graphql-client.

Thebigbignooby avatar Thebigbignooby commented on May 3, 2024

Result using the official introspection query you linked to :
stantard-introspection-not-working

Result using the query I pasted above
working-instrospection

from aor-simple-graphql-client.

djhi avatar djhi commented on May 3, 2024

The strange thing is that aor-simple-graphql-client use the official introspection query as you can see here

from aor-simple-graphql-client.

djhi avatar djhi commented on May 3, 2024

oh wait, misread...

from aor-simple-graphql-client.

djhi avatar djhi commented on May 3, 2024

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.

djhi avatar djhi commented on May 3, 2024

I'm using the graphql-server-koa package on server side though.

from aor-simple-graphql-client.

djhi avatar djhi commented on May 3, 2024

And you can see here that this is the query used by graphiql too

from aor-simple-graphql-client.

djhi avatar djhi commented on May 3, 2024

Please do explain what happened when you find it

from aor-simple-graphql-client.

Thebigbignooby avatar Thebigbignooby commented on May 3, 2024

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.

Thebigbignooby avatar Thebigbignooby commented on May 3, 2024

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.

djhi avatar djhi commented on May 3, 2024

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.

djhi avatar djhi commented on May 3, 2024

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.

Thebigbignooby avatar Thebigbignooby commented on May 3, 2024

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.

djhi avatar djhi commented on May 3, 2024

Np: FIY my project using aor and this client is https://github.com/djhi/dpc

from aor-simple-graphql-client.

Thebigbignooby avatar Thebigbignooby commented on May 3, 2024

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
greenplate-1

However, below, you can see in the Appollo dev tools that GraphiQL has no problem getting this information.

greenplate-2

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.

mulyoved avatar mulyoved commented on May 3, 2024

@Thebigbignooby

check my changes in #25

let me know if need help

from aor-simple-graphql-client.

Thebigbignooby avatar Thebigbignooby commented on May 3, 2024

@mulyoved
thanks . . . But i'm confused, what's the hack I'm looking at ?

from aor-simple-graphql-client.

mulyoved avatar mulyoved commented on May 3, 2024

This is a fork that adjusts the introspection to fit graph.cool

from aor-simple-graphql-client.

Thebigbignooby avatar Thebigbignooby commented on May 3, 2024

I understand, But I don't see what the adjustment is.

from aor-simple-graphql-client.

mulyoved avatar mulyoved commented on May 3, 2024

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.

djhi avatar djhi commented on May 3, 2024

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.

vysakh0 avatar vysakh0 commented on May 3, 2024

@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.

mulyoved avatar mulyoved commented on May 3, 2024

@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.

vysakh0 avatar vysakh0 commented on May 3, 2024

@djhi Cool, thank you! 👍

from aor-simple-graphql-client.

manolkalinov avatar manolkalinov commented on May 3, 2024

@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.

djhi avatar djhi commented on May 3, 2024

Hi there, see #40 :) In a nutshell, I'm working on a new cleaner client.

from aor-simple-graphql-client.

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.