Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
109 views

How to add custom HTTP response to graphql createHandler method?

GraphQl returns 200 even in case of error but with errors object in response. I want to set it to 400. Assume I need to integrate it into createHandler? import { createHandler } from "graphql-...
John Glabb's user avatar
  • 1,589
1 vote
1 answer
24 views

GraphQl is not able to execute mutation with apollo

I have given mutation query for adding book details. I have to accept 3 params dynamically. this is my bookQuery.js const ADD_BOOK = gql`{ mutation ($name: String!, $genre: String!, $authorId: ID!)...
Ashish Khokhariya's user avatar
0 votes
0 answers
23 views

HOW GENERATE PRISMA SECRET in Express js using typescript?

I am having difficulty finding the prism secret, I have run the command: yarn prisma:generate but it only generates a folder without a secret key enter image description here My expectation is to get ...
Arga Fauzianto's user avatar
0 votes
0 answers
44 views

How to Define an Input Union Type for File Uploads or Direct URLs in GraphQL Schema and Check Input Type in Resolver Mutation?

I'm working on a GraphQL schema where I need to allow users to upload files or provide direct URLs as input for an image field in a mutation. However, I'm facing difficulty defining an input type that ...
Asad Ali's user avatar
0 votes
0 answers
19 views

Can't display any Resolver Relationships in GraphQL

I have been trying to use GraphQL for a couple weeks now and am still yet to make a single resolver relationship work out. I'm using ExpressJS as the server. I want something as simple as a User has ...
Apoptosome's user avatar
0 votes
0 answers
54 views

How to use GraphQL to retrieve only one field based on compound query

I am working with the Graphiql at https://data.rcsb.org/graphql/index.html?query=%7B%0A%20%20polymer_entity_instances(instance_ids%3A%20%5B%221S0H.A%22%5D)%0A%20%20%7B%0A%20%20%20%20rcsb_id%0A%0A%20%...
Jamie's user avatar
  • 782
0 votes
0 answers
52 views

Why is GraphQL's limit parameter not respecting the partitionkey in a query instruction?

I need to understand the logic of the method with which GraphQL operates a query. In a react application, I have the following code: export const fetchPatientsChatMessages = async ( partitionKey: ...
Peter Mattheisen's user avatar
1 vote
0 answers
35 views

Mixing Apollo v3 and v4 GraphQL in a federated graph

We have a mixture of Apollo v2 and Apollo v3 services running right now, and federation is working very well amongst them. We're about to start upgrading services to Apollo v4. There have been a ...
Mayur Patel's user avatar
0 votes
0 answers
71 views

Error: middleware options must contain a schema using express-graphql

For some reason, when using the schema below, I get the error "GraphQL middleware options must contain a schema." when trying to load the GraphiQL page, and an error status 500 when making ...
mfusco's user avatar
  • 47
0 votes
0 answers
23 views

No overload matches app.use('/graphql', graphQLServer); Hasura GraphQL

I was following the hasura backend guide where the server is initalized as below. import { readFileSync } from "node:fs"; import { createServer } from "@graphql-yoga/node"; import {...
Harshit Maheshwari's user avatar
0 votes
0 answers
103 views

response status coming as 200 in graphql even if I send 400 Bad Request Exception

In my nestjs application, I am throwing BadReuqestException for one graphql endpoint. But in the response I still see 200 Ok I tried throwing GraphQLError also but not working. formatError: (error) =&...
testidvic's user avatar
0 votes
1 answer
44 views

How do I define a typeDefs in a schema for the following response?

I am trying to define a typeDefs for the following response in graphql: CompactRes={ "Compact": [ [ 0, 1, 2, 3 ], [ 4, 5, 6, [ ...
Gowtham's user avatar
  • 1,597
0 votes
1 answer
291 views

How to change Http Status code when getting error from GraphQL?

I want to change http status code when throw error like with "throw new Error("this is my error.")"? I want this because i should return localized error message in frontend. How ...
Tarik Ulker's user avatar
-1 votes
1 answer
98 views

How to enable explorer tab and add authorization prefix in graphiql playground?

How to add (ex. "Authorization" : null ) prefix in graphiql playground How to enable explorer tab to get available query and mutations
dmx's user avatar
  • 83
0 votes
0 answers
1k views

graphql-file upload (POST body missing, invalid Content-Type, or JSON object has no keys.)

I'm currently working on implementing file uploads in GraphQL, but I'm encountering an issue. Whenever I try to upload a file, I receive the following error message: "POST body missing, invalid ...
user22127283's user avatar
0 votes
1 answer
359 views

how to interact and fetch data from elasticsearch to graphql APOLLO 4

so here's my code, i'm really stuck my friends, i have no idea how to send data from my database to graphql, even when i try to do a POST request i receive NULL! here's my code divided in 5 files. ...
anfield's user avatar
  • 41
1 vote
3 answers
3k views

graphql-http Missing query

Followed steps by steps just trying to integrate graphql from provided documentation of expressjs, https://github.com/graphql/graphql-http#with-express import express from 'express'; // yarn add ...
Faivsq's user avatar
  • 23
0 votes
0 answers
234 views

Graphql send the query to db for all columns or selected column provided by the frontend

Graphql has the ability that it returns only these column which is requested by the front end. But I have a question,Graphql send the query to db for all columns or selected column provided by the ...
Mudasser's user avatar
0 votes
1 answer
388 views

I am looking to find a way to a test graphql server with graphql-request library

I am using graphql-tag and supertest-graphql to test my apollo-server-express app. The following is my current approach. it('Query a quote', async () => { const id = '123456'; const ...
Nimo shr's user avatar
3 votes
0 answers
868 views

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 ...
Moritz Roessler's user avatar
1 vote
0 answers
90 views

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@...
Rishikesh singh's user avatar
0 votes
1 answer
35 views

Running method on every call using express-graphql

I'm using express-graqphl and was wondering if there is any concept of running a function before each graphql endpoint is executed? I'd like to have this for things like validating JWTs and other ...
d512's user avatar
  • 34k
0 votes
0 answers
154 views

Is GraphQL with codegen support wildcard operation?

I'm using graphql-codegen to generate typescript type from graphql schema. I'm trying to perform wildcard operation. query User($query: USERQueryInput){ user(query: $query){ _id ...
Anupam Choudhary's user avatar
0 votes
1 answer
684 views

How to structure nested lists of objects in GraphQL typeDefs

I have a type user which will contain an array of associated objects which are also a type which is defined. I am trying to figure out the best way to handle input types when creating objects like ...
SteroidMan's user avatar
0 votes
1 answer
1k views

(Graphql) The resolver value isn't of type object

I'm trying to use anilist public api while trying to set a backend using express and apollo, but I'm getting an error when I try to do a query using the ID of an anime to get some of its details. Any ...
Kurokishin's user avatar
1 vote
0 answers
248 views

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 (...
GhostOrder's user avatar
1 vote
2 answers
435 views

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 ...
user3349255's user avatar
2 votes
0 answers
71 views

Accessing GraphiQL over a JWT protected route in ExpressJS

So far I've always had one big painpoint with GraphQL. I'm very well aware that you can specify headerEditorEnabled when you setup express-graphql like this: graphiql: { headerEditorEnabled: true, }, ...
Dac0d3r's user avatar
  • 1,854
0 votes
0 answers
490 views

req.headers.authorization coming back as undefined

I'm pretty new to graphql and apollo, and I'm working on a project where I need to be able to use context to get a variable for my query. The issue that I'm having is that my context.user is coming ...
pelotador.1's user avatar
1 vote
1 answer
2k views

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 ...
pelotador.1's user avatar
0 votes
1 answer
495 views

Context within express-graphql returns a function

I'm trying to create an authentication strategy using context within express-graphql, however, when I access context within isAuthenticated it returns [Function: context]. What am I not understanding? ...
bp123's user avatar
  • 3,407
0 votes
0 answers
736 views

GraphQL get all results for a collection

I am trying to get a list of all items in a collection with graphql, i am new to this and right now trying multiple things but nothing is working, below is what makes sense to me but as i said doesnt ...
Kravitz's user avatar
  • 2,859
0 votes
1 answer
115 views

Express GraphQL: I want to create a Team and populate with players, by passing the players IDs, but I can't find the correct syntax

Using Express-graphql, mongo/mongoose/ react. Im Creating a database with Teams, Players, and Matches. I want to write a mutation for creating a new team, which lists its players given their IDs, but ...
cordovez's user avatar
0 votes
1 answer
137 views

Graphql schema, add multiple custom objects in and and or

I am new to graphql, working on an existing schema. I've to add new filters into my existing API, but either my syntax is wrong or my query in postman is wrong. Essentially, I want to be able to query ...
Pavanraotk's user avatar
  • 1,127
3 votes
1 answer
351 views

GraphQL Subscriptions is null using Express-GraphQL and graphql-subscriptions

I am using TypeScript and have Server and Client application. Below is the server code. Server Code import express, { Express } from "express"; import { graphqlHTTP } from "express-...
Aqdas's user avatar
  • 940
-1 votes
1 answer
133 views

Make a user object property resolved inside @FieldResolver (posts)

I am creating a reddit clone, using a type-graphql, express-graphql and typegoose, first i run a query for posts and i get the user info (_id, username) : query posts { posts { _id title ...
Mohamed Majilan's user avatar
2 votes
1 answer
328 views

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 ...
Itakpe Emmanuel's user avatar
1 vote
1 answer
248 views

apolloGateway cannot connect to graphql express service

I ran a service using apolloGateway: export const server = async () => { const app = express(); const services = [ { name: "product-service", url: "http://localhost:4001/graphql&...
Furkan Gulsen's user avatar
0 votes
1 answer
423 views

How to create an array in the GraphQL's argumment as GraphQL Code First Approach

In GraphQL Code First Approach I am trying to pass the same argumment for createUser in createManyUser but I want to pass it as an array to create many users at once. I searched a lot but couldn't ...
Maher Aldous's user avatar
0 votes
1 answer
226 views

Node JS - GraphQL - Elastic Search - Elasticsearch mapping does not contains info about is field plural or not

Elasticsearch mapping does not contains info about is field plural or not. So propName is singular and returns value or first value from array. propNameA is plural and returns array of values. I am ...
tycoon74's user avatar
0 votes
0 answers
128 views

GraphQL query returns null data

My schema looks like this And my server setup looks like this When I perform a Query operation or Mutation Operation It works well, but when I perform a subscription operation, it shows that the ...
Malik Abdulaziz's user avatar
1 vote
0 answers
279 views

buildschema from graphql throws 'TypeError: nodes.flatMap is not a function'

Am using node version 10.24.0. But when I try the example from the official site. const graphql = require('graphql'); const schema = graphql.buildSchema(` type Query { hello: String }`); I ...
Adithya Sama's user avatar
0 votes
1 answer
965 views

Cannot return null for non-nullable field - Typegoose and TypeGraphQL

I have this Album model set up using Typegoose and TypeGraphQL, which contains multiple songs from the Song model using the AlbumSong ObjectType: import { prop as Property, getModelForClass, ...
Bowis's user avatar
  • 626
1 vote
1 answer
704 views

How to return a rejected Promise to Graphql?

I've got a login method that returns a Promise to GraphQL to resolve. If the user is found and authenticated it resolves the user and works as it should. However, if the account doesn't exist or ...
aarona's user avatar
  • 37.2k
0 votes
1 answer
83 views

Do not work .map() to mapping all data which I get from database in mongoose and express-graphql

I get all data in mongoose using .find() and try to mapping this data in express and express-graphql. So .find() work correctly and return all data but when I try to use .map() for mapping all data ...
Towfiq Amiri's user avatar
10 votes
9 answers
17k views

Error: No "exports" main defined in graphql-upload/package.json

Have installed graphql-upload, do import { graphqlUploadExpress } from 'graphql-upload'; And getting this error: Error: No "exports" main defined in graphql-upload/package.json Dependencies: ...
howdyho's user avatar
  • 311
2 votes
2 answers
1k views

How to achieve GraphQL Error Handling for Multiple Items?

I have been learning GraphQL and right now I am learning things related to Error Handling in GraphQL. I referred to this article for Error Handling in GraphQL. Now, from Article I understand that If I ...
D_Gamer's user avatar
  • 300
1 vote
0 answers
238 views

Having trouble connecting apollo sql datasource with mssql; getting "Login failed for user <username>"

I'm trying to send GraphQL queries to a mssql database utilizing the Apollo SQL datasource. I believe the error is in the configuration object, since it's recognizing that I'm trying to access the ...
Max Lee's user avatar
  • 11
1 vote
1 answer
2k views

Graphql response error. String cannot represent value of JSON

I have an error here at graphql. I'm trying get an airport name through JSON data. I need a single item which's (name of the airport) but I'm receiving array of items with it's city, country, ...
Dany 46's user avatar
  • 23
0 votes
1 answer
315 views

Sequelize/Apollo returns null on one to many relationship

I am working on a project with Express/ApolloServer/Sequelize/Postgres. I have two tables, one containing Sheep and the other containing Breeds. Breeds table is just an id and breed_name column. Every ...
Nika Bo's user avatar
  • 63

1
2 3 4 5
8