How resolve Operations and Map with GraphQL-js?

33
May 15, 2019, at 7:10 PM

basically im trying upload a file with GraphQl js vanilla, but i dont know how resolve operations and map

im getting this error:

Must provide Source. Received: [\"operations\", \"map\"]"

mutation($file: Upload) {
  UploadImage(image: $file) {
    mimetype
  }
}

the query results

{
    operations: '{"query":"mutation($file: Upload) {
        UploadImage(image: $file) { mimetype }}","variables":{"file":null},"operationName":null}',
    map: '{"0":["variables.file"]}'
}

im using grapqhl promise

graphql(schema, query, rootval, null, vars).then((response) => {

more info of graphql promise

graphql(
  schema: GraphQLSchema,
  requestString: string,
  rootValue?: ?any,
  contextValue?: ?any,
  variableValues?: ?{[key: string]: any},
  operationName?: ?string
): Promise<GraphQLResult>

the resolver for upload file

Upload: GraphQLUpload,
    Mutation: {
        UploadImage: async({req},{ image }) => {
            const { filename, mimetype, createReadStream } = await image
            console.log(filename)
            const stream = createReadStream()
            // Promisify the stream and store the file, then…
            return mimetype;
        }
    }
READ ALSO
puppeteer issue on CentOs 7 problem after exactly 30 minutes

puppeteer issue on CentOs 7 problem after exactly 30 minutes

i have a script that use node js and puppeteer, the script run wonderful on my windows 10 for as long as i dont close it from command line, when i`m using it

26
Deploying a precompiled nodejs function to Azure Functions v2 Syncing 2 function triggers with payload size 317 bytes successful

Deploying a precompiled nodejs function to Azure Functions v2 Syncing 2 function triggers with payload size 317 bytes successful

I have created a Nodejs function app using Visual Studio Code and it runs successfully when I run it on VS Code but when I deploy to Azure portal I get following that syncing 2 function triggers when I have only one

30