Questions tagged [express-graphql]

GraphQL HTTP Server Middleware

Create a GraphQL HTTP server with any HTTP web framework that supports connect styled middleware, including Connect itself, Express and Restify.

386 questions
2
votes
2 answers

After installing graphql-tools and graphql-express. Error message in console 'Cannot find name 'AsyncIterator'

Error Log On initiating application While initiating the application it shows the following error and i tried couple of fixes from online which has mentioned below but none of them has worked requesting for suggestions and solutions…
Rigin Oommen
  • 3,060
  • 2
  • 20
  • 29
2
votes
1 answer

return status code from graphql yoga

From graphql yoga, inside of my resolvers I check before resolver call, if this resolver is protected or not. If resolver is protected, and user is not signed in I can throw an error like this: return new Error('Token is missing'); This stops…
Adam
  • 3,415
  • 4
  • 30
  • 49
2
votes
2 answers

Cannot read property 'startsWith' of undefined at Object.renderGraphiQL

i was going through a GraphQL tutorial from udemy, https://www.udemy.com/introduction-to-graphql-and-apollo-building-modern-apis And i was going through the guide to operating graphql and graphiql -> apollo -express - server. And got this. This…
user9630712
2
votes
2 answers

"Type RootQueryType must define one or more fields." }

Trying to get GraphQL to work with JavaScript. Not sure where my mistake is. My code const graphql = require('graphql'); const _ = require('lodash'); const { GraphQLObjectType, GraphQLString, GraphQLInt, GraphQLSchema } = graphql; const…
2
votes
1 answer

Mutation returns 400 error but works in GraphiQL

I've been following tutorials and trying to learn graphql with react and express and I'm running into trouble. My mutation works when I plug it into graphiql but not when I call it from my client. Client code: async addBook(params) { var title =…
Hjelmut4
  • 83
  • 1
  • 6
2
votes
1 answer

Return only non-null values from GraphQLList object

My sampleJSON - { "entries": [ { "fields":{ "title":"My test title" } }, { "fields":{ "description":"My test description" } } ] } Schema.js - const rootQuery = new GraphQLObjectType({ …
arjary
  • 169
  • 1
  • 12
2
votes
1 answer

GraphQL nested query Lookup

I am using graphql-tools for schema generation. This query works fine query{ links(id: 1) { url resources{ type active } } } My question is what the "resolver" will be for nested query so that it returns resource of 8902…
Pujan
  • 3,154
  • 3
  • 38
  • 52
2
votes
3 answers

NodeJs GraphQL enum type value as dynamic

https://launchpad.graphql.com/9qvqz3v5r Here is my example graphQL Schema. i am trying to use enum type. How do i get enum values from backend and give it into schema? // Construct a schema, using GraphQL schema language const typeDefs = ` type…
2
votes
1 answer

NodeJs GraphQL fragments resolver

Its my example. am trying fragment . am not sure how will i connect fragment to resolver. Can anyone help me?https://launchpad.graphql.com/9qvqz3v5r If i query as below { user { userId firstName lastName …
mpriyaah
  • 65
  • 1
  • 7
1
vote
0 answers

How to pass headers in a GraphQL subscription request?

I am trying to pass custom headers in a GraphQL subscription request, but the headers don't seem to be included in the WebSocket message. I am using the @apollo/client library on the client-side and ApolloServer from 'apollo-server-express' on the…
1
vote
0 answers

Error: RootQueryType fields must be an object with field names as keys or a function which returns such an object

userData is just an array of object with some dummy data something like this { id: 1, first_name: "Deny", last_name: "Scrange", email: "dscrange0@paginegialle.it", Password: "268403811-2", }, So here this is just a program…
1
vote
0 answers

Mutually exclusive args

Is it possible to set mutually exclusive args? like: type Query { listings (sellerId: ID! | landlordId: ID!): [Listing] } I know that I can let both args as optional: type Query { listings (sellerId: ID, landlordId: ID): [Listing] } But that's…
GhostOrder
  • 586
  • 7
  • 21
1
vote
2 answers

How to configure Serverless Lambda for Graphql API with Typescript

I am new to AWS and trying to deploy a GraphQL API written in NodeJS as an AWS Lambda using Serverless. I have followed several tutorials that are close to what I am doing but cannot get the handler to work. The closest tutorial to what I am doing…
1
vote
1 answer

Cant Return Array in Graphql Query

I'm pretty new to graphql and I'm working on a project in nodejs where I am trying to return users when a getUsers query is performed. The issue is that when I test this query in graphql studio, I'm getting an error stating: "GraphQLError: Cannot…
pelotador.1
  • 195
  • 1
  • 12
1
vote
1 answer

How to use custom GraphQLScalarType with default GraphQL types?

I created a GraphQLScalarType to prevent arguments with empty strings. The issue however is if I don't pass the argument at all when calling the mutation, the mutation succeeds and gives the field a value of null. Usually, I'd wrap the type in a…