Send dropbox file as attachement

Hi there, thanks a lot for this powerful tool !
I just deployed N8N and I’m having a lot of fun with it :slight_smile:

It seems I can’t donwload the file from dropbox in order to send it as attachement via Gmail.

Error message :

ERROR: Bad request - please check your parameters

400 - {"type":"Buffer","data":[69,114,114,111,114,32,105,110,32,99,97,108,108,32,116,111,32,65,80,73,32,102,117,110,99,116,105,111,110,32,34,102,105,108,101,115,47,100,111,119,110,108,111,97,100,34,58,32,89,111,117,114,32,97,112,112,32,105,115,32,110,111,116,32,112,101,114,109,105,116,116,101,100,32,116,111,32,97,99,99,101,115,115,32,116,104,105,115,32,101,110,100,112,111,105,110,116,32,98,101,99,97,117,115,101,32,105,116,32,100,111,101,115,32,110,111,116,32,104,97,118,101,32,116,104,101,32,114,101,113,117,105,114,101,100,32,115,99,111,112,101,32,39,102,105,108,101,115,46,99,111,110,116,101,110,116,46,114,101,97,100,39,46,32,84,104,101,32,111,119,110,101,114,32,111,102,32,116,104,101,32,97,112,112,32,99,97,110,32,101,110,97,98,108,101,32,116,104,101,32,115,99,111,112,101,32,102,111,114,32,116,104,101,32,97,112,112,32,117,115,105,110,103,32,116,104,101,32,80,101,114,109,105,115,115,105,111,110,115,32,116,97,98,32,111,110,32,116,104,101,32,65,112,112,32,67,111,110,115,111,108,101,46]}

Cause

{

"message": "400 - {"type":"Buffer","data":[69,114,114,111,114,32,105,110,32,99,97,108,108,32,116,111,32,65,80,73,32,102,117,110,99,116,105,111,110,32,34,102,105,108,101,115,47,100,111,119,110,108,111,97,100,34,58,32,89,111,117,114,32,97,112,112,32,105,115,32,110,111,116,32,112,101,114,109,105,116,116,101,100,32,116,111,32,97,99,99,101,115,115,32,116,104,105,115,32,101,110,100,112,111,105,110,116,32,98,101,99,97,117,115,101,32,105,116,32,100,111,101,115,32,110,111,116,32,104,97,118,101,32,116,104,101,32,114,101,113,117,105,114,101,100,32,115,99,111,112,101,32,39,102,105,108,101,115,46,99,111,110,116,101,110,116,46,114,101,97,100,39,46,32,84,104,101,32,111,119,110,101,114,32,111,102,32,116,104,101,32,97,112,112,32,99,97,110,32,101,110,97,98,108,101,32,116,104,101,32,115,99,111,112,101,32,102,111,114,32,116,104,101,32,97,112,112,32,117,115,105,110,103,32,116,104,101,32,80,101,114,109,105,115,115,105,111,110,115,32,116,97,98,32,111,110,32,116,104,101,32,65,112,112,32,67,111,110,115,111,108,101,46]}",

"name": "Error",

"stack": "Error: Request failed with status code 400 at createError (/home/bas/app_1ceab9ce-06e9-4e7b-9d14-09dc5fcb7c0e/node_modules/axios/lib/core/createError.js:16:15) at settle (/home/bas/app_1ceab9ce-06e9-4e7b-9d14-09dc5fcb7c0e/node_modules/axios/lib/core/settle.js:17:12) at IncomingMessage.handleStreamEnd (/home/bas/app_1ceab9ce-06e9-4e7b-9d14-09dc5fcb7c0e/node_modules/axios/lib/adapters/http.js:269:11) at IncomingMessage.emit (events.js:412:35) at endReadableNT (internal/streams/readable.js:1334:12) at processTicksAndRejections (internal/process/task_queues.js:82:21)"

}

stack

NodeApiError: Bad request - please check your parameters
    at Object.dropboxApiRequest (/home/bas/app_1ceab9ce-06e9-4e7b-9d14-09dc5fcb7c0e/node_modules/n8n-nodes-base/dist/nodes/Dropbox/GenericFunctions.js:30:15)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Object.execute (/home/bas/app_1ceab9ce-06e9-4e7b-9d14-09dc5fcb7c0e/node_modules/n8n-nodes-base/dist/nodes/Dropbox/Dropbox.node.js:858:36)
    at async /home/bas/app_1ceab9ce-06e9-4e7b-9d14-09dc5fcb7c0e/node_modules/n8n-core/dist/src/WorkflowExecute.js:451:47

Please share the workflow

Share the output returned by the last node

[

{

"id": "id:J5EhLilf83oAAAAAAAABEg",

"name": "2021_11 facture masques pharmacie.pdf",

"lastModifiedClient": "2021-11-27T10:14:23Z",

"lastModifiedServer": "2022-03-19T14:22:08Z",

"rev": "5da92fd03669e94a603f1",

"contentSize": 228187,

"type": "file",

"contentHash": "b825b3855486d4c8a8d4a1ecb35b4bd08c4718911cd595512497d921d9711891",

"pathLower": "/scans/cegid/2021_11 facture masques pharmacie.pdf",

"pathDisplay": "/Scans/CEGID/2021_11 facture masques pharmacie.pdf",

"isDownloadable": true

},

{

"id": "id:J5EhLilf83oAAAAAAAABaQ",

"name": "2022_03_10_18_19_44 assurance 2022 generali.pdf",

"lastModifiedClient": "2022-03-10T17:19:57Z",

"lastModifiedServer": "2022-03-19T14:22:08Z",

"rev": "5da92fd0366ad94a603f1",

"contentSize": 285889,

"type": "file",

"contentHash": "a643ca1e5595195fc04d50c65f2a2bc9cbab92169e324fec7953058dce3566c6",

"pathLower": "/scans/cegid/2022_03_10_18_19_44 assurance 2022 generali.pdf",

"pathDisplay": "/Scans/CEGID/2022_03_10_18_19_44 assurance 2022 generali.pdf",

"isDownloadable": true

}

]

Information on your n8n setup

  • n8n version: 0.168.2
  • Database you’re using (default: SQLite): PostgreSQL
  • Running n8n with the execution process [own(default), main]: I don’t understand this question
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: npm

I’d be very grateful someone could help me.

Thanks a lot !

Hi @Clement_Hostache, many thanks for your kind words and sorry for the trouble here.

I wonder if this might be a problem with the axios library we are using since a while now. Could you try setting the environment variable N8N_USE_DEPRECATED_REQUEST_LIB=true (this will temporarily switch to the deprecated old library) and confirm whether the problem persists?

Hi @MutedJam , thanks for your reply :slight_smile:

I tried setting the env variable as suggested, and the problem is still there, but it appears we have more information about it.
Here is the result (look at hte bottom part) :

{
"name": "StatusCodeError",
"statusCode": 400,
"message": "400 - {"type":"Buffer","data":[69,114,114,111,114,32,105,110,32,99,97,108,108,32,116,111,32,65,80,73,32,102,117,110,99,116,105,111,110,32,34,102,105,108,101,115,47,100,111,119,110,108,111,97,100,34,58,32,89,111,117,114,32,97,112,112,32,105,115,32,110,111,116,32,112,101,114,109,105,116,116,101,100,32,116,111,32,97,99,99,101,115,115,32,116,104,105,115,32,101,110,100,112,111,105,110,116,32,98,101,99,97,117,115,101,32,105,116,32,100,111,101,115,32,110,111,116,32,104,97,118,101,32,116,104,101,32,114,101,113,117,105,114,101,100,32,115,99,111,112,101,32,39,102,105,108,101,115,46,99,111,110,116,101,110,116,46,114,101,97,100,39,46,32,84,104,101,32,111,119,110,101,114,32,111,102,32,116,104,101,32,97,112,112,32,99,97,110,32,101,110,97,98,108,101,32,116,104,101,32,115,99,111,112,101,32,102,111,114,32,116,104,101,32,97,112,112,32,117,115,105,110,103,32,116,104,101,32,80,101,114,109,105,115,115,105,111,110,115,32,116,97,98,32,111,110,32,116,104,101,32,65,112,112,32,67,111,110,115,111,108,101,46]}",
"error": {
"type": "Buffer",
"data": [
69,
114,
114,
111,
114,
32,
105,
110,
32,
99,
97,
108,
108,
32,
116,
111,
32,
65,
80,
73,
32,
102,
117,
110,
99,
116,
105,
111,
110,
32,
34,
102,
105,
108,
101,
115,
47,
100,
111,
119,
110,
108,
111,
97,
100,
34,
58,
32,
89,
111,
117,
114,
32,
97,
112,
112,
32,
105,
115,
32,
110,
111,
116,
32,
112,
101,
114,
109,
105,
116,
116,
101,
100,
32,
116,
111,
32,
97,
99,
99,
101,
115,
115,
32,
116,
104,
105,
115,
32,
101,
110,
100,
112,
111,
105,
110,
116,
32,
98,
101,
99,
97,
117,
115,
101,
32,
105,
116,
32,
100,
111,
101,
115,
32,
110,
111,
116,
32,
104,
97,
118,
101,
32,
116,
104,
101,
32,
114,
101,
113,
117,
105,
114,
101,
100,
32,
115,
99,
111,
112,
101,
32,
39,
102,
105,
108,
101,
115,
46,
99,
111,
110,
116,
101,
110,
116,
46,
114,
101,
97,
100,
39,
46,
32,
84,
104,
101,
32,
111,
119,
110,
101,
114,
32,
111,
102,
32,
116,
104,
101,
32,
97,
112,
112,
32,
99,
97,
110,
32,
101,
110,
97,
98,
108,
101,
32,
116,
104,
101,
32,
115,
99,
111,
112,
101,
32,
102,
111,
114,
32,
116,
104,
101,
32,
97,
112,
112,
32,
117,
115,
105,
110,
103,
32,
116,
104,
101,
32,
80,
101,
114,
109,
105,
115,
115,
105,
111,
110,
115,
32,
116,
97,
98,
32,
111,
110,
32,
116,
104,
101,
32,
65,
112,
112,
32,
67,
111,
110,
115,
111,
108,
101,
46
]
},
"options": {
"timeout": 300000,
"headers": {
"dropbox-api-path-root": "{".tag":"root","root":"xxxxxxxxxxxxxxxxxxxxxxxx"}",
"Authorization": "Bearer sl.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
"method": "POST",
"qs": {
"arg": "{"path":"/Scans/CEGID/2021_11 facture masques pharmacie.pdf"}"
},
"uri": "https://content.dropboxapi.com/2/files/download",
"json": true,
"encoding": null,
"simple": true,
"resolveWithFullResponse": false,
"transform2xxOnly": false
},
"response": {
"statusCode": 400,
"body": {
"type": "Buffer",
"data": [...] // 263 items
},
"headers": {
"cache-control": "no-cache",
"content-security-policy": "sandbox allow-forms allow-scripts",
"x-content-type-options": "nosniff",
"content-type": "text/plain; charset=utf-8",
"accept-encoding": "identity,gzip",
"date": "Thu, 24 Mar 2022 12:08:21 GMT",
"server": "envoy",
"content-length": "263",
"strict-transport-security": "max-age=31536000; includeSubDomains; preload",
"x-robots-tag": "noindex, nofollow, noimageindex",
"vary": "Accept-Encoding",
"x-dropbox-response-origin": "far_remote",
"x-dropbox-request-id": "431101e085de48adaa8bd3c0bbbd543b",
"connection": "close"
},
"request": {
"uri": {...}, // 12 keys
"method": "POST",
"headers": {...} // 4 keys
}
}
}

Hey @Clement_Hostache, sorry for the delay, it’s been rather busy over here.

I gave this a go on my end, running n8n through both docker and npm and also tested a bunch of different settings that I imagined might influence the result here.

However, your workflow (minus the Gmail node) completed fine every time I tried running it, even for larger files.

image

So I am wondering if there might be a reverse proxy, firewall or anything else sitting between n8n and Dropbox that might interfere with the download. Could you check if that’s the case and confirm details around how you run n8n and how it’s connected to the internet (such as your reverse proxy configuration, if applicable)?

Another thing that came to my mind is whether your actual file might play a role here. Do you own the file? Does the problem also occur with other files?

Hi @MutedJam
thanks a lot for your time. I found the issue thanks to you : I was trying to download a file owned by another dropbox account. When I use the other account, it works !
So glad I got the solution !
Thanks again :slight_smile:

Shoud I edit the Topic as Solved or something ?
Edit : nevermind, I found the Solution tickbox :wink:

1 Like