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.

Improve documentation for handling results of uploads in express/koa

See original GitHub issue

I didn’t want to file an issue but am not sure where to get help.

I’ve followed the steps to get the express middleware working, I’ve followed tutorials for sending in the query from my client side, but I don’t understand what to do in my express controller handling the actual file.

In my arguments, all I get is an object of { file: { path: 'filename.png' } }

The file doesn’t exist in the os.tmpdir, I can’t use createReadStream on it, etc.

It’s possible I’m not sending in the data right, but I’ve structured my api query just like other tutorials did:

query: `
    mutation($file: Upload!) {
        server:createServer(
            input: {
                bannerFile: $file,
                name: "${values.serverName}",
                address: "${values.serverAddress}",
                description: "${values.serverDescription}"
            }) { id }
        }`,
variables: {
    file: values.bannerFile // this comes directly from the files from a file input. 
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
viveleroicommented, Jun 20, 2021

Ok, I went through and moved my schema creation over to makeExecutableSchema. I had to tweak the signatures of all my methods but it appears to be working better now. I no longer see a nested .file but can use const { mimetype, createReadStream } = await input.bannerFile; directly.

1reaction
viveleroicommented, Jun 19, 2021

Ok you’re probably right. I’ll look into that and report back. Appreciate your help and time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

typestack/routing-controllers - GitHub
Routing-controllers uses multer to handle file uploads. You can install multer's ... You can use any existing express / koa middleware, or create...
Read more >
Upload Documents for Assessment Verification
Upload Documents for Assessment Verification Print ... The Verification Report compiles a list of the selected questions from a user's Assessment ...
Read more >
Regulatory Management: Working with Documents
Uploading, Editing, Comparing, and Deleting Documents. Do's and Don'ts for Uploading Files to eResearch Regulatory Management ...
Read more >
Issues Uploading Documents: Common Errors, Causes, and ...
The issues and solutions presented here are meant to help troubleshoot issues when uploading documents using the DocuSign web application only.
Read more >
Error handling — Boto3 Docs 1.26.37 documentation
Overview¶. Boto3 provides many features to assist in navigating the errors and exceptions that you might encounter when interacting with AWS services.
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