When using the node HTTP Request, with a basic post (see below), the API requests from me to have a header: “Content-Type”: “application/x-www-form-urlencoded”.
But as soon as I use it, I have this error:
str.replace is not a function
at Querystring.rfc3986 (/usr/local/lib/node_modules/n8n/node_modules/request/lib/querystring.js:43:14)
at Request.json (/usr/local/lib/node_modules/n8n/node_modules/request/request.js:1287:30)
at Request.init (/usr/local/lib/node_modules/n8n/node_modules/request/request.js:406:10)
at Request.RP$initInterceptor [as init] (/usr/local/lib/node_modules/n8n/node_modules/request-promise-core/configure/request2.js:45:29)
at new Request (/usr/local/lib/node_modules/n8n/node_modules/request/request.js:127:8)
at Object.request (/usr/local/lib/node_modules/n8n/node_modules/request/index.js:53:10)
at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest.node.js:797:51)
at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/src/Workflow.js:492:37)
at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:416:62
I found a similar issue on github but the solution seems not to work for me (or I implemented it wrongly, sorry).
Thanks to both of you. I tried both but it hasn’t worked.
@jan: I have this error now
ERROR: RequestError: Error: Argument error, options.body.
Error: RequestError: Error: Argument error, options.body.
at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest.node.js:806:27)
at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:416:47
@ivov: the body is not “understood” by the API as a consequence if I do that. It just tells me “client_id” is not set while it is actually included in the body …
It still looks like the body is not recognized by the API. Here’s the error message I have: ERROR: StatusCodeError: 400 - "{\"error\":\"unauthorized_client\",\"error_description\":\"client_id is not set\"}"
The only thing I can think of is that you send the client_id wrong. So that the API for example expects it in the query parameter or header but you send it via body.
With the latest n8n-version ([email protected]) will it now display the request the HTTP Request node does in the browser console. Maybe that helps you to figure out what the difference is.
As alternative can you send both requests (from n8n and Postman) to a page like https://webhook.site to see the difference.