hi all,
i got an error with big file (30Mo+) on http post, image file
ERR_FR_MAX_BODY_LENGTH_EXCEEDED
our env,
nginx limit 1Go
export N8N_PAYLOAD_SIZE_MAX=64
the goal is to read files on source1 (from url), change name, calc size, and write on source2
after change payload size max i can read big files, change the name, without error, but
on http post to the source 2
i got this error with this file
https://dam.coreplighting.com:8443//razuna/assets/1/25BFDEFB126D45DF98C87E7C0D30F19E/img/EBA6F1CA0C3243F0B408DC86D31C8039/91922_suspension_PLAYA.3L.jpg
[
{
"error": {
"message": "Request body larger than maxBodyLength limit",
"name": "Error [ERR_FR_MAX_BODY_LENGTH_EXCEEDED]",
"stack": "Error [ERR_FR_MAX_BODY_LENGTH_EXCEEDED]: Request body larger than maxBodyLength limit at RedirectableRequest.write (/opt/n8n/app/node_modules/follow-redirects/index.js:102:24) at FormData.ondata (node:internal/streams/legacy:20:31) at FormData.emit (node:events:390:28) at FormData.CombinedStream.write (/opt/n8n/app/node_modules/combined-stream/lib/combined_stream.js:138:8) at FormData.CombinedStream._pipeNext (/opt/n8n/app/node_modules/combined-stream/lib/combined_stream.js:126:8) at FormData.CombinedStream._realGetNext (/opt/n8n/app/node_modules/combined-stream/lib/combined_stream.js:99:10) at FormData.CombinedStream._getNext (/opt/n8n/app/node_modules/combined-stream/lib/combined_stream.js:82:12) at FormData.CombinedStream.resume (/opt/n8n/app/node_modules/combined-stream/lib/combined_stream.js:154:10) at FormData.CombinedStream.pipe (/opt/n8n/app/node_modules/combined-stream/lib/combined_stream.js:66:8) at dispatchHttpRequest (/opt/n8n/app/node_modules/axios/lib/adapters/http.js:326:10)",
"code": "ERR_FR_MAX_BODY_LENGTH_EXCEEDED"
}
}
]
simple workflow
Thanks for help
i find this but don’t know how to use it
Hi @Christel_Doudet,
You could use axios
directly through a Function node when setting the NODE_FUNCTION_ALLOW_EXTERNAL=axios
variable (see Environment Variables | Docs for a full list of all variables). @RicardoE105 posted an example in Upload File: Multipart-formdata - #8 by RicardoE105.
You could also force the HTTP Request node to use the old requests library by setting N8N_USE_DEPRECATED_REQUEST_LIB=true
to see if this works with your file.
1 Like
Hi @MutedJam ,
thanks, i thought that the problem was a redirect from N8N to axios, i will try to use axios directly,
so :
env variables, ok
const axios = require('axios');
for the function with unlimited length i found this
const result = await axios({
url: `the url`,
headers: {
'Authorization': `Bearer ${auth_token}`,
'Content-Type': 'application/json'
},
method: 'post',
data: {
'ParentId': record_id,
'Name': file_name,
'body': body,
'Description': description ? description : "",
'maxContentLength': Infinity,
'maxBodyLength': Infinity
}
});
now my question is how i can link my precedent node and send the file ?:
If your file lives comes through a binary property data, you could reference the file content using: items[0].binary.data.data
. Here’s an example in which I am doing this which I had laying around (just replace the URL with a new one from hookbin.com or a similar service if you want to see it working). It’s not quite what you’re looking for since it uses request-promise-native
(and a much smaller file), but it still shows nicely how to reference binary data in the Function node:
I am unfortunately fairly busy with other stuff today, but if you’re struggling with making your axios request, leave a comment on this and I’ll try to put a similar example together for axios tomorrow unless someone beats me to it.