API for file uploads gets aborted #33706
Replies: 2 comments
-
|
Sounds similar to this: prisma/prisma#21655 |
Beta Was this translation helpful? Give feedback.
-
|
Luckily I managed to find the issue. Firstly, Secondly, it seems like neither const form = formidable({
maxFields: 2,
maxFileSize: config.public.maxFileSize
});
let fields;
let files;
try {
[fields, files] = await form.parse(event.node.req);
} catch (err: any) {
console.log(err);
throw createError({
statusCode: 422,
statusMessage: "Pailed to parse form data"
});
}
const file = files.file?.at(0) || null;
const note = fields.note?.at(0) || null;
// Read file contents
const content = await fs.readFile(file.filepath); |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working on an app that allows file uploads to a SQLite databse. The file contents are stored as a BLOB in the database itself.
I have made an API to handle this on the server side:
And here's the component that handles uploads on the client:
The issue is that while smaller files (<1MB) work just fine, larger ones (>20MB) fail with the following error being displayed on the server console:
I also tried implementing the API using
readMultipartFormDatainstead ofreadFormData, but that results in the same error. Is there some kind of body size limitation somewhere? AIs keep suggesting that, but I could not find anything in any documentation that would explain how to increase such a limit. The error is also too generic, so Googling won't help.Beta Was this translation helpful? Give feedback.
All reactions