Tag: apollo-server
-
Implementing Middleware to Retrieve JWT Tokens from Header in a GraphQL Server with Node.js and Apollo
0 I’m trying to create a middleware to receive a token from the header, but it never seems to trigger, and I never see the ‘hello’ log message I inserted at the top of the middleware. const jwt = require(‘jsonwebtoken’); const { GraphQLError } = require(‘graphql’); module.exports = async ({ req }) => { console.log(‘hello’);…
-
Handling error in apollo graphql returns invalid doctype even when content type is json
-1 I have tried sending 404 status using json-server and it works with postman as seen below. But when I’m doing it inside apollo sandbox, it’s giving me this invalid doctype. Not sure why json-server is sending out html instead of json content type because I’ve already set it Here is the json-server Here’s my…
-
websocket subscription server not working. unable to reach subscription server graphql-ws ws
2 i follow the [same documentation code][1] for creating subscription server using websocket graphql, put it doesn’t work with graphql-ws and ws the code worked when i removed the serverCleanup definition, and it also woks well for older subscription library "subscription-transport-ws" my index.js const { ApolloServer } = require(‘apollo-server-express’) const { ApolloServerPluginDrainHttpServer } = require(‘apollo-server-core’)…
-
GraphQL/APOLLO – Cannot query field “field_name” on type “Query”
0 I am trying to make a query like this in the latest apollo/server 4.9 and graphqlClient – 3.7 like below: const USER_DATA = gql` query getUserData($subdomain: String!) { getUserData(subdomain: $subdomain) { _id full_name email valid_complex_password projects { _id image_url title description street_address city province country } } } but keep getting this: { "errors":…
-
GraphQL mutation in KeystoneJS: “Cannot use ‘in’ operator to search for ‘id’ in undefined”
0 In a KeystoneJS GraphQL project I’m trying to create a new data object (an “Article”) in the ‘resolveInput’ hook of another, existing, data object (a “Proposal” — when a Proposal is approved, I create an Article based on that Proposals’data). This worked fine using the Mongoose adapter, but I’ve tried to do it using…
-
I’m getting an error when I try to upload in GraphQL: “POST body missing, invalid Content-Type, or JSON object has no keys.”
0 My code is correct, but I don’t know what’s happening, I need to upload it with graphQL but I can’t, my resolver code looks like this: `import { Resolver, Query, Mutation, Arg } from "type-graphql"; import { GraphQLUpload, FileUpload } from "graphql-upload-ts"; @Resolver() export class CategoryResolver { @Mutation(() => String) async uploadImage(@Arg("file", () =>…
-
Error from a non-sharable field defined in a subgraph that shoudn’t have this field
1 I have multiple GraphQL microservices (subgraphs, using ApolloFederationDriver) with a GraphQL gateway (using ApolloGatewayDriver) I have a really strange bug since I’ve upgraded my GraphQL microservices and gateway to use @apollo/server (@nestjs/graphql@11 + @nestjs/apollo@11) : I have an error when my subgraphs are composed telling me that subgraph A has a non shareable field…
-
Node.js, Apollo Server v4, GraphQL, Mongoose – Category Tree
1 I am trying to create Category Tree with Node.js, Apollo Server v4, GraphQL, Mongoose technologies. But when I want to get the created Category or Subcategory data, the output is not what I want. Categories appear both in subCategories as a reference and as a normal category. I also added category data with this…
-
Node.js, Apollo Server, GraphQL, Mongoose – Category Tree
0 I am trying to create Category Tree with Node.js, Apollo Server, GraphQL, Mongoose technologies. But when I want to get the created Category or Subcategory data, the output is not what I want. Output; { "data": { "getCategories": { "success": true, "response_code": "categories-successfully-retrieved", "message": "Categories Successfully Retrieved!", "categories": [ { "_id": "655a1b6018951b0985fd7635", "name": "K…
-
How can I upload file in Apollo server V4
7 I’m using the newer version of apollo server V4, I need assistance on how to upload images or videos from Frontend to cloudinary and save the url to MongoDB database… please help 🙏 I have read through Apollo docs but there are no answers there… I’m kind of stuck now reactjs express graphql apollo-server…