express-graphql

createReadStream() throwing RangeError: Maximum call stack size exceeded when uploading file

北战南征 提交于 2021-02-07 12:19:56
问题 I am trying to use Apollo Server's Upload scalar to send files to S3 directly. My schema: const { gql } = require('apollo-server-express') module.exports = gql` extend type Mutation { createPicture( name: String! picture: Upload! ): Picture! } type Picture { name: String! picture: String! } ` Resolver: const { combineResolvers } = require('graphql-resolvers') const isAuthenticated = require('./auth') const { uploadPhoto } = require('../services/picture') module.exports = { Mutation: {

createReadStream() throwing RangeError: Maximum call stack size exceeded when uploading file

空扰寡人 提交于 2021-02-07 12:19:01
问题 I am trying to use Apollo Server's Upload scalar to send files to S3 directly. My schema: const { gql } = require('apollo-server-express') module.exports = gql` extend type Mutation { createPicture( name: String! picture: Upload! ): Picture! } type Picture { name: String! picture: String! } ` Resolver: const { combineResolvers } = require('graphql-resolvers') const isAuthenticated = require('./auth') const { uploadPhoto } = require('../services/picture') module.exports = { Mutation: {

Making a graphQL mutation from my python code, getting error

◇◆丶佛笑我妖孽 提交于 2020-08-01 19:03:43
问题 I am trying to make a mutation to my Shopify store from python. I am new to graphQL, I have been able to make the mutation using graphiQL but I am not certain how to do it directly from my code. This is my make query file, it has worked successfully for a simple query `import requests def make_query(self, query, url, headers): """ Return query response """ request = requests.post(url, json={'query': query}, headers=headers) if request.status_code == 200: return request.json() else: raise

graphqlHTTP is not a function

荒凉一梦 提交于 2020-07-16 02:22:28
问题 Here is my simple graphql experess app const express = require('express'); const graphqlHTTP = require('express-graphql'); const app = express(); app.use( '/graphql', graphqlHTTP({ graphiql: true, }) ); app.listen(4000, () => { console.log("listening for request!"); }); I'm getting the following errors when I run it: graphqlHTTP({ ^ TypeError: graphqlHTTP is not a function at Object.<anonymous> (D:\PersonalProjects\GraphQL\server\app.js:7:5) at Module._compile (internal/modules/cjs/loader.js

Graphql create relations between two queries.Error cannot access before initialization

孤者浪人 提交于 2020-07-10 10:37:33
问题 I have this code: const ProductType = new GraphQLObjectType({ name: 'Product', fields: { id: { type: GraphQLID }, name: { type: GraphQLString }, category: { type: CategoryType, resolve: async (parent) => { return await Category.findOne({_id: parent.category}); } } } }); const CategoryType = new GraphQLObjectType({ name: 'Category', fields: { id: { type: GraphQLID }, name: { type: GraphQLString }, products: { type: ProductType, resolve: async (parent, args) => { return await Product.find(

How to throw multiple errors with express-graphql?

萝らか妹 提交于 2020-06-23 02:56:24
问题 In an express-graphql app, I have a userLogin resolver like so: const userLogin = async ({ id, password }), context, info) => { if (!id) { throw new Error('No id provided.') } if (!password) { throw new Error('No password provided.') } // actual resolver logic here // … } If the user doesn't provide an id AND a password , it will throw only one error. { "errors": [ { "message": "No id provided.", "locations": [ { "line": 2, "column": 3 } ], "path": [ "userLogin" ] } ], "data": { "userLogin":

How to throw multiple errors with express-graphql?

孤街醉人 提交于 2020-06-23 02:56:01
问题 In an express-graphql app, I have a userLogin resolver like so: const userLogin = async ({ id, password }), context, info) => { if (!id) { throw new Error('No id provided.') } if (!password) { throw new Error('No password provided.') } // actual resolver logic here // … } If the user doesn't provide an id AND a password , it will throw only one error. { "errors": [ { "message": "No id provided.", "locations": [ { "line": 2, "column": 3 } ], "path": [ "userLogin" ] } ], "data": { "userLogin":

Apollo 2.0.0 Graphql cookie session

冷暖自知 提交于 2020-05-25 06:30:06
问题 Can someone help me on this, My setup was as follows prior to Apollo 2.0, I had a server.js in which i used express and graphql-server-express I had a http only cookie session, when a user logs in I set the jwt token as a cookie and it is set in browser as http only. On subsequent request I validate the cookie that the browser passes back. It was all working fine and I could access the token from req.session.token in any other resolver and validate the jwt token saved in the cookie session.