Tag: apollo-server
-
Integrating Firebase w/ GraphQL: passing Firestore as context
0 I’ve decided to integrate Firebase into GraphQL and I am passing firestore as a context value when creating ApolloServer however when I run the loginUser query I get an empty object in my console: {} I’ve gone through the GraphQL context documentation and have attempted to pass the object different ways (passing context via…
-
Confusion in initialising GraphQL Dataloader in context
0 context: ({ req }) => { if (req) { return { ip: headers.userip, headers, userLanguage, decodedToken, dataLoaders: { seoDataLoader: createSeoDataLoader() } } } } Here I create a createSeoDataLoader instace for every request . now suppose if i have 50 loaders then for every request 50 loaders instance created and i think its not…
-
How to call sub-field in delegateToSchema
0 Schema looks like this: type Query { userManagement: UserManagementQueries! } type UserManagementQueries { users(…): UserManagementUsersConnection } … So the query looks like: query { userManagement { users(ids: [123, 456]) } } How can I call this with delegateToSchema where I can only set a fieldName? How do I call a "sub"-field? return info.mergeInfo .delegateToSchema({…
-
Mock a ESM function using Jest in Apollo Server tests
0 I am trying to setup my integration tests in Apollo Server 4 using Jest and typescript In my resolver code I have a function checkIfAuthorized which validates if a user has certain access. I am trying to mock this function and always return me a particular value I have a folder src/tests/integration where my…
-
Knex query with .where() returns null in GraphQL
0 I’m trying to build a simple api with knex and apollo server, which is running, but the querys with where retuns null the server import { ApolloServer } from ‘apollo-server’ import knex from ‘./knex’ import { resolvers, typeDefs } from ‘./schema’ import { UserSQLDataSource } from ‘./schema/users/datasource’ const server = new ApolloServer({ typeDefs, resolvers,…
-
while sending array of enum i got Error from typescript graphql nestjs api
0 Question My Stack: BE NestJS, graphQL(code first approach), prisma / FE NextJS Problem: For my model "Conventions" all fields working to send from FE to GraphQL NestJS API, but one field uses an array of an enum Called "ConGenres" i am not able to figure out why it doesnt work this way: FE (NextJs)…
-
How to upload single / multiple images using Apollo-server-express and mongodb?
0 Image upload using Apollo server and mongodb database . If any body has solution or reference, please let me know. Thank you node.js mongodb express graphql apollo-server Share Follow asked Jul 17 at 13:48 DigenDigen 5999 bronze badges Add a comment | 1 Answer 1 Sorted by: Reset to default Highest score (default) Trending…
-
“”POST body missing, invalid Content-Type, or JSON object has no keys.” Error on Apollo v4
0 //Sever.js import { ApolloServer } from ‘@apollo/server’; import { startStandaloneServer } from ‘@apollo/server/standalone’; import {makeExecutableSchema} from "@graphql-tools/schema"; import {typeDefs, resolvers} from "./schema.js"; import { expressMiddleware } from ‘@apollo/server/express4’; import { ApolloServerPluginDrainHttpServer } from ‘@apollo/server/plugin/drainHttpServer’; import express from ‘express’; import http from ‘http’; import cors from ‘cors’; import bodyParser from ‘body-parser’; async function startServer(port, callback){…
-
Apollo Server 4 / Koa – Cannot read properties of undefined (reading ‘headers’)
0 i upgraded to apollo 4 and i am using koa js. But there are some problems with context. Authentication process does not work. Authentication time I get an error like this: **"message": "Cannot read properties of undefined (reading ‘headers’)" "code": "INTERNAL_SERVER_ERROR", @[email protected][email protected]/node_modules/@apollo/server/dist/esm/utils/schemaInstrumentation.js:36:28) backend/graphql/resolvers/posts.js:31:20 backend/util/check-auth.js:5:36** import { ApolloServer } from "@apollo/server"; import { ApolloServerPluginDrainHttpServer }…
-
How to create Resolvers for this apollo graphql server
-1 How to Create Resolvers for Apollo GraphQL Server using the Given Output and Type Definitions { "data": { "department": [ { "id": "123", "booksubdepartment": [ { "id": "111", "departmentID": "123", "books": [ { "subdepartmentId":"111", "bookTitle": "Book One on sub department 111" }, { "subdepartmentId":"111", "bookTitle": "Book Two on sub department 111" } ] },…