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.

how to handle maxFileSize errors with graphqlUploadExpress

See original GitHub issue

Hello, sorry if this is a duplicate, i didn’t found it.

How one can handle the maxFileSize error with express?

I am seeing this error

UnhandledPromiseRejectionWarning: PayloadTooLargeError: File truncated as it exceeds the 100000 byte size limit.

But I don’t see how to attach any callback to the graphqlUploadExpress

Thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rafinskipgcommented, Mar 1, 2021

I’m sorry but it does not seem to work with my current set-up.

It seems that the error is launched when createReadStream because the file is bigger than the size. Anyway, wrapping createReadStream with a try/catch seems to work for me! Thanks Mr jaydenseric. May the force be with you

1reaction
rafinskipgcommented, Feb 25, 2021

How do you handle the file upload stream errors?

I just followed the documentation:

app.use(graphqlUploadExpress({ maxFileSize: 1000000, maxFiles: 10 }));
Read more comments on GitHub >

github_iconTop Results From Across the Web

graphqlUploadExpress maxFileSize restriction not work #274
Hi guys I have this config in my nestjs api main.ts const { API_UPLOADS_MAX_FILESIZE, API_UPLOADS_MAX_FILES } = process.env; ...
Read more >
How to use the graphql-upload.graphqlUploadExpress ... - Snyk
Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues...
Read more >
File upload error in graphql apollo-server - Stack Overflow
I am learning graphql .I followed this article https://dev.to/dnature/handling-file-uploads ...
Read more >
graphql-upload - npm
Handle file upload promise rejection and stream errors; uploads sometimes ... graphqlUploadExpress({ maxFileSize: 10000000, maxFiles: 10 }),.
Read more >
NestJS file upload with GraphQL - Dilusha Dasanayaka
Here we going to use graphql-upload package additionally to handle the file ... app.use(graphqlUploadExpress({ maxFileSize: 1000000, maxFiles: 10 }));
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