Tag: express
-
Cannot read properties of undefined (reading ‘isAuth’) in React and GraphQL application
0 I’m encountering an error when trying to create a post in my React application using a GraphQL mutation. The error message is: { "errors": [ { "message": "Cannot read properties of undefined (reading ‘isAuth’)", "status": 500 } ], "data": { "createPost": null } } This suggests that the req.isAuth property is undefined when the…
-
Print GraphQL query logs and integrate DataLoader
0 I have been trying to log out my query logs to see how many queries my query is performing to get the feeling why to use DataLoader. The project im working on is a star wars GraphQL api , and i noticed bad performance when doing such a query: query { film(id: 2){ title…
-
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’);…
-
Best way to performantly resolve nested GraphQL queries with MongoDB
0 I am trying to write a resolver which gets the accounts belonging to a customer. The parent.accounts attribute is an array of account_ids. In the code below, I attempt to get an array of accounts for each customer. import Account from "../models/accounts.js"; import Customer from "../models/customers.js"; import { AccountInterface } from "../types/accounts.js"; import {…
-
Best way to resolve nested GraphQL queries with MongoDB
0 I am trying to write a resolver which gets the accounts belonging to a customer. The parent.accounts attribute is an array of account_ids. In the code below, I attempt to get an array of accounts for each customer. import Account from "../models/accounts.js"; import Customer from "../models/customers.js"; import { AccountInterface } from "../types/accounts.js"; import {…
-
Trying to use redis store with express-session with the help of connect-redis official docs
0 Here’s what I’m trying to do. I’m trying to use redis as store with express-session but get an error : src/index.ts(14,20): error TS7009: ‘new’ expression, whose target lacks a construct signature, implicitly has an ‘any’ type. src/index.ts(15,5): error TS2353: Object literal may only specify known properties, and ‘client’ does not exist in type ‘(options?:…
-
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…
-
Unexpected LAMBDA_RUNTIME Failed to post handler success response. Http response code: 413 error
14 So I have a serverless express application running in a Lambda. One request (response size around 800KB) keeps returning a LAMBDA_RUNTIME Failed to post handler success response. Http response code: 413. error. I thought it could be due to some internal logic timing out, and added logs, and all the fetch and processing takes…
-
why i can’t connect with my api , the header of requset is (blocked by cors) nodejs
0 I want to return data from my graphql API, I have two front-end in one of these is work, but in another front-end, it doesn’t work when I run the first front end in this port it works but for the second one to doesn’t work and it says blocked by cors policy hare…
-
How to accept POST request from a remote server on a GraphQL Server
0 I am working on a project currently using GrapQL. I am integrating a payment processor, when the user payment is successful, the payment processor sends a POST request to the webhook URL that is meant to point to my server. Now I was wondering how to achieve this, considering that GraphQL exposes just one…