Giter Club home page Giter Club logo

Comments (5)

TheMaximeBatandeoExperience avatar TheMaximeBatandeoExperience commented on June 2, 2024 2

I finally found the reason of the bug. I am using a monorepo and there were conflicts between versions of GraphQl (16.8 and 15.8). In graphQl-tools, there was a deprecation with the field isPossibleType which led to an invalid schema. The fix was to upgrade graphql at the root of the monorepo and it worked

from graphql.

neo4j-team-graphql avatar neo4j-team-graphql commented on June 2, 2024

Many thanks for raising this bug report @TheMaximeBatandeoExperience. 🐛 We will now attempt to reproduce the bug based on the steps you have provided.

Please ensure that you've provided the necessary information for a minimal reproduction, including but not limited to:

  • Type definitions
  • Resolvers
  • Query and/or Mutation (or multiple) needed to reproduce

If you have a support agreement with Neo4j, please link this GitHub issue to a new or existing Zendesk ticket.

Thanks again! 🙏

from graphql.

mjfwebb avatar mjfwebb commented on June 2, 2024

Hi @TheMaximeBatandeoExperience, I can't reproduce this issue locally. Are you able to provide a full code-example which reproduces this issue?

from graphql.

TheMaximeBatandeoExperience avatar TheMaximeBatandeoExperience commented on June 2, 2024

Yes, thank you for your quick answer

import {getNeo4JSession} from "./neo4j";
import {Neo4jGraphQL} from "@neo4j/graphql";

export const neoSchema = async () => {
  try {
    const {driver} = await getNeo4JSession();
    const schema = new Neo4jGraphQL({
      typeDefs: `#graphql
    type Movie {
        title: String
        actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN)
    }

    type Actor {
        name: String
        movies: [Movie!]! @relationship(type: "ACTED_IN", direction: OUT)
    }
`,
      driver
    });
    const yogaSchema = await schema.getSchema();
    return yogaSchema;
  } catch (error) {
    console.error("Error initializing schema", error);
  }
};

I use it a nextJs 14 AppRouter. So i created a route api/graph/route.ts where my yoga server lives using the implementation in the yoga documentation

import { createSchema, createYoga } from 'graphql-yoga'
 
const { handleRequest } = createYoga({
  schema: await neoSchema()
    }
  }),
 
  // While using Next.js file convention for routing, we need to configure Yoga to use the correct endpoint
  graphqlEndpoint: '/api/graphql',
 
  // Yoga needs to know how to create a valid Next response
  fetchAPI: { Response }
})
 
export { handleRequest as GET, handleRequest as POST, handleRequest as OPTIONS } 

Also I tried with apollo server and same trouble.
I am not sure that it is relevant but from the beginning I always had a Typescript error with the schema provided by Neo4jGraphQl (with Apollo or Yoga)
Unable to assign 'GraphQLSchema | undefined' au type 'YogaSchemaDefinition<{}, {}> | undefined Missing isPossibleType

from graphql.

angrykoala avatar angrykoala commented on June 2, 2024

Hi @TheMaximeBatandeoExperience
Sorry, but the code you provided doesn't seem correct as it is invalid javascript (maybe a copy paste problem?).

Please refer to this example on how to set up a yoga server with Neo4j GraphQL (you can ignore the typedefs and the subscription on that example), I just checked that example and the js code should work.

For how to integrate yoga with NextJS you'll need to refer to either one of those projects.

from graphql.

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.