Closed SergioSuarezDev closed 2 years ago
It's supposed to emit a relevant error on the file upload stream:
The test we have for maxFileSize
doesn't seem to test the error
event emits for a large file that streams in multiple chunks, instead it tests the scenario where createReadStream()
throws:
Ideally both scenarios would be tested. Once I've worked through some other graphql-upload
updates I can improve these tests and hopefully verify it's working correctly.
A common gotcha about the graphql-upload
limit options: Make sure your Apache/nginx config is looser than the graphql-upload
configured limits, that way errors will be handed nicely the GraphQL way instead of however your server deals with oversized requests, etc.
silly mistake hehe I had to make a parseint of the data that it loads from the .env because they are always strings, now it works
const { API_UPLOADS_MAX_FILESIZE, API_UPLOADS_MAX_FILES } = process.env; app.use( graphqlUploadExpress({ maxFieldSize: parseInt(API_UPLOADS_MAX_FILESIZE), maxFileSize: parseInt(API_UPLOADS_MAX_FILESIZE), maxFiles: parseInt(API_UPLOADS_MAX_FILES) }) );
Hi guys
I have this config in my nestjs api main.ts
Config in .env file:
20000000 bytes = 20MB
But when i try to upload 70MB file, the api doesn't show any error, it is as if this restriction did not work