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
5
votes
1 answer

GraphQL Mutation Body Parser

Just updated to 'graphql-server-express' version 1.3.0 and now I am getting this error when running any mutations: POST body missing. Did you forget use body-parser middleware? When initializing the server, I am including the "body-parser" package…
matt
  • 63
  • 1
  • 4
5
votes
1 answer

GraphQL descriptive success messages in mutations

Currently in GraphQL JS implementation there is no standard way of returning a descriptive success message from mutation, such as "User created successfully", etc. My question has 2 parts: My thinking is that it is beneficial to return a success…
andr111
  • 2,982
  • 11
  • 35
  • 45
4
votes
1 answer

Passing Objects as Argument to GraphQL Mutation (graphql-request)

I have a very basic graphql mutation in the frontend that I send to my backend. I am using this code on the by graphql-request as a guide. With primitives it works: const mutation = gql` mutation EditArticle($id: ID!, $title: String) { …
4
votes
0 answers

Running Subscriptions on GraphiQL using express-graphql, graphql, graphql-subscriptions and graphql-subscriptions-ws

I'm fairly new to GraphQL and currently familiarizing myself by making a quiz application using React on the front-end. At the moment, I'm busy with my back-end. After successfully setting up queries and mutations, I am finding it difficult to get…
4
votes
1 answer

Why my GraphQL subscriptions are working on local server but not when deployed on live server

I am building a GraphQL server and have subscriptions in it. Once I deploy the server on my local machine and check the subscription in Playground it works, i.e. it listens to events and I get the newly added data. It means the subscriptions…
Fateh
  • 101
  • 6
4
votes
1 answer

GraphQLObjectType for subscriptions

I implemented a GraphQL server using Express, and I have an issue with the setup of GraphQL Subscription type. I'm developing a real time chat app and I'm trying to publish an event after a new message is created, but I don't understand how should I…
4
votes
1 answer

Error with Auth0 and Graphql - TypeError: Cannot read property 'publicKey' of undefined

I am currently trying to setup authentication for Graphql via Auth0. The issue we are facing is inside our authenticate Mutation returning the error \validateAndParseIdToken.js:25 jwt.verify(idToken, key.publicKey, { …
tsbi11
  • 53
  • 1
  • 5
4
votes
1 answer

Graphql input type of array of objects

I have this schema: type Preference{ _id: ID! uID: ID! preferences: [Category!]! } type Category{ name: String! subcategories: [String]! } type RootMutation{ createPreference(perferenceInput: PerferenceInput) :…
Lasse
  • 597
  • 2
  • 10
  • 33
4
votes
2 answers

SyntaxError: Unexpected token < in JSON at position 0 when testing in Graphiql

I am learning GraphQL and am new to the technology. I am unable to figure out the cause for this syntax error. When I am testing it on graphiql it throws an unexpected token syntax error Here is my server.js: const express =…
Vishesh Thakur
  • 195
  • 2
  • 3
  • 9
4
votes
1 answer

GraphQLError: Syntax Error: Cannot parse the unexpected character ";"

I'm a beginner in GraphQL. While setting the server, connecting to mongodb database and doing a mutation, I'm getting following error after running node index.js. GraphQLError: Syntax Error: Cannot parse the unexpected character ";". Here's my…
user8817816
  • 61
  • 1
  • 1
  • 3
3
votes
1 answer

How to pass object type argument in query in GraphQL?

I got this type of query query { searchRandom (param : MyObjectClass){ city } } How may I set param with the type of MyObjectClass and pass it in the query? To be able to test here?
Bob Redity
  • 529
  • 5
  • 14
3
votes
1 answer

What is the difference between GraphQLJSON and GraphQLJSONObject exported by graphql-type-json?

From the official package documentation: GraphQLJSON can represent any JSON-serializable value, including scalars, arrays, and objects. GraphQLJSONObject represents specifically JSON objects, which covers many practical use cases for JSON…
shet_tayyy
  • 5,366
  • 11
  • 44
  • 82
3
votes
0 answers

apollo-federation validate input field in another subgraph

in microservice project I have configured graphql, apollo-federation, apollo-gateway. Menu service mutation createMenu(location_id: ID!): Menu Location service type Location{ id: ID! } type Query{ location(id: ID!): Location } in menu…
3
votes
0 answers

How to use graphiql-explorer with express-graphql

I ran the express-graphql by this code. var { graphqlHTTP } = require('express-graphql'); var { buildSchema } = require('graphql'); // Construct a schema, using GraphQL schema language var schema = buildSchema(` type Query { hello: String …
gz89
  • 532
  • 3
  • 18
3
votes
1 answer

Cookie not set, even though it is in response headers. Using express-session cookies

Problem: Trying to set the cookie on login using express-session, but think I'm missing something obvious. The response to the login POST request includes Set-Cookie. I've also set the Access-Control-Allow-Origin and Access-Control-Allow-Headers to…
gddh
  • 71
  • 1
  • 5
1 2
3
25 26