question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GraphQL File Update / Express not working without graphql-upload package

See original GitHub issue

Hi, based on the documentation I thought we will not need any additional package for the File Upload.

We have an Express Server.

const yogaServer = createYogaServer({
    schema,
    plugins,
});

// serve graphQL
app.use(
    Config.GRAPHQL_ENDPOINT,
    (req, res, next) => {
      (req as any).identifier = v4();
      next();
    },
    // graphqlUploadExpress(),
    yogaServer,
);

Without the use of the graphqlUploadExpress middleware we are getting the following error:

400 Bad Request
{
    "data": null,
    "errors": [
        {
            "message": "Must provide query string."
        }
    ]
}

Documentation: https://www.graphql-yoga.com/docs/features/file-uploads

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ardatancommented, Jul 4, 2022

Thanks for the reproduction @JoJ123 ! I think this issue seems to be gone as well with the versions here. https://github.com/dotansimha/graphql-yoga/pull/1337#issuecomment-1172455572 Could you confirm? https://codesandbox.io/s/compassionate-newton-3hsvu6?file=/server.ts

0reactions
ardatancommented, Jul 4, 2022

Thanks @JoJ123 for your help! New version with fixes is out! https://github.com/dotansimha/graphql-yoga/pull/1343

Read more comments on GitHub >

github_iconTop Results From Across the Web

File uploads not working with graphql-upload package #901
Current behavior. I was going through tutorials on how to use NestJS with graphql. I wanted to create a mutation to upload a...
Read more >
File uploads - Apollo GraphQL Docs
Enabling file uploads in Apollo Server.
Read more >
Apollo-Server-Express not receiving Upload Object
I've tried in the resolver to await the file and then display it, but it still displays as being empty. I've added code...
Read more >
File Uploads on GraphQL: Why or Why not
For our File Upload to work, we need to initialize the graphql-upload package in our main.ts. import { NestFactory } from '@nestjs/core'; ...
Read more >
File Uploads with GraphQL, Google Cloud Storage and Node.js
Uploading files to Google Cloud Storage with an Express GraphQL server ... This middleware is available in the graphql-upload package:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found