I am trying to use the HTTP request node to get access token, but I am getting this error. When I tried with Postman it worked. Any solution to this? Thanks
{
"status": "rejected",
"reason": {
"message": "Request failed with status code 502",
"name": "Error",
"stack": "Error: Request failed with status code 502 at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15) at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12) at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11) at IncomingMessage.emit (events.js:327:22) at endReadableNT (internal/streams/readable.js:1327:12) at processTicksAndRejections (internal/process/task_queues.js:80:21)"
}
}
Oh, you mean it was working in n8n before yesterday? Did you upgrade your version or change anything else (if so, can you confirm what changes exactly you have made)?
Sorry, I didn’t realize you were using the cloud version. I did some additional testing in the meantime and it seems I blamed axios too early.
It seems the API simply doesn’t like the default user-agent header for whatever reason and responds with the non-helpful error we both have encountered. As soon as I was manually setting a different user-agent header, the request is working fine.
So you can probably solve it for your account as well (tested this on cloud v0.148.0) simply by adding this header to your HTTP Request node, for example:
Hi, the access token works. But today an issue arised on the second node that uses AccessToken. It was giving this error on the cloud version. I am using email finder API request
{
"error": {
"message": "Request failed with status code 400",
"name": "Error",
"stack": "Error: Request failed with status code 400 at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15) at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12) at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11) at IncomingMessage.emit (events.js:327:22) at IncomingMessage.EventEmitter.emit (domain.js:467:12) at endReadableNT (internal/streams/readable.js:1327:12) at processTicksAndRejections (internal/process/task_queues.js:80:21)"
}
}
Hi @zocket, I am not familiar with this API and currently don’t have a lot of time for extensive testing. A 400 error suggests you are sending a request the server considers invalid.
So it would be great if you could help by providing a reproducible example workflow leading to the error you are facing as well as a link to the documentation of the respective API.
Hi @zocket, to follow up on this, is this the API endpoint you are having issues with? This is working fine for me when I tried this on n8n.cloud (where access_token is provided by the previous node):