Comments (6)
Sure, here's what I did:
import { ApolloServer } from "@apollo/server";
import { startStandaloneServer } from "@apollo/server/standalone";
import { Neo4jGraphQL } from "@neo4j/graphql";
import { OGM } from "@neo4j/graphql-ogm";
import neo4j from "neo4j-driver";
const driver = neo4j.driver(
"bolt://localhost:7687",
neo4j.auth.basic("username", "password")
);
const typeDefs = `#graphql
type User {
id: ID! @id
firstName: String!
lastName: String!
email: String! @unique
}
`;
const ogm = new OGM({ typeDefs, driver });
const User = ogm.model("User");
const resolvers = {};
const neoSchema = new Neo4jGraphQL({
typeDefs,
driver,
resolvers,
});
async function main() {
const schema = await neoSchema.getSchema();
await ogm.init();
const server = new ApolloServer({
schema,
});
const { url } = await startStandaloneServer(server, {
context: async ({ req }) => ({ req }),
});
console.log(`🚀 Server ready at ${url}`);
const [record] = await User.find({
where: { id: "your-id-here" },
});
console.log(record);
}
main();
Where you replace your-id-here
with the id generated. I selected the ID from when I created the user through a mutation:
mutation Mutation {
createUsers(
input: [{ email: "[email protected]", firstName: "First", lastName: "Last" }]
) {
users {
id
}
}
}
from graphql.
Many thanks for raising this bug report @gethassaan. 🐛 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.
Hi @gethassaan I tried to reproduce this, but I can successfully request specific users via their IDs, without any issue.
Some thoughts:
- Did you create the users through GraphQL? It might be an ID mismatch if you made them yourself elsewhere.
- Can you test without having a NestJS service in between? NestJS may be causing a problem. Perhaps a cache?
from graphql.
Hey @mjfwebb, I created the user via Graphql and the ID's were auto generated and regarding the cache i'm sure it's not cache since I also tried this with a new (fresh) clone.
And as I am trying a simple query as mentioned above, I am out of clues to why this might be happening. 🥲
Can you also share how did you fetch the users? Any process or steps that you followed?
from graphql.
Thank you @mjfwebb your solution does work, I am not sure why would the bug be coming up. 🤔
from graphql.
@gethassaan I'll close the issue then, since we confirmed it's not on our side.
from graphql.
Related Issues (20)
- Subscriptions don't support update_relationship
- Field with populatedBy directive should appears in UpdateInput or CreateInput when not defined in the operations HOT 8
- Cannot deactivate the top-level queries for unions HOT 10
- Export the Neo4jGraphQLError classes
- Add "filtering" and "sorting" support to fields that rely on custom resolvers HOT 1
- Relationship is settable via update mutation, but settable directive is set to false. HOT 9
- Wrong cypher generated for nodes with multiple labels HOT 2
- `Neo4jError: Invalid input 'WHERE': expected` when using auth in specific scenarios HOT 3
- Argument "phrase" is blocked for custom cypher queries since Neo4j-GraphQL >5 HOT 2
- Querying an interface produces very slow query with a lot of UNION HOT 3
- Neo4jError: Variable not defined caused by authorization filters HOT 4
- Regression on ID scalar type filtering HOT 8
- Neo4jError: Variable `<propertyName>Count` not defined HOT 5
- Error "Cannot return null for non-nullable field" when limit exceeds result count in queries with non-nullable fields HOT 2
- Authorization rules can't compare enum property with context HOT 3
- Compatibility of @neo4j/graphql with neo4j-driver HOT 14
- GraphQL parsing issue with `[[String!]]!` HOT 2
- Filtering issue in `@authorization` directive HOT 2
- Nested mutation with deep connect inside a create is failing with the error- Neo4jError: Variable `this` already declared HOT 3
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 graphql.