n8n http request to SemaphoreUI API only works randomly.
This seems to be a really weird issue and hopefully I have described it correctly! I have an n8n automation which makes a call to SemaphoreUI API and (authenticates with a bearer token) it runs a specific ansible playbook - playbook number 5 or as n8n sees it in the variables:
“name”: “template_id”,
“value”: “5”
Everything works perfectly as expected however, if I duplicate the node and add it to the same workflow as an additional step later and make only one change to the values - the template_id to “7” instead of the original number “5”, the process fails citing Bad Request etc. No matter what value I change it to other than 5 in n8n it fails (the other values being that of other ansible playbooks that SemaphoreUI has configured).
Strangely enough, if I download the workflow from n8n and open it in Visual code studio and change the “5” to a “7” and import it back as a new workflow it works! If I then change the “7” back to “5” in n8n it breaks again so I am really confused about what is happening here and unsure if it is an n8n issue or SemaphoreUI one. If I use Postman to do the same API call it works for whatever playbook value I specify so this leads me to suspect perhaps it’s an n8n problem somehow? Both n8n and semaphoreui are self hosted on a local lan on same hypervisor.
What is the error message (if any)? “Bad request - please check your parameters”
Please share your workflow
{
“meta”: {
“instanceId”: “34aa1191088d9904526754fc1fd0890555e45f15009a62bb18e2ba17d11eedc6”
},
“nodes”: [
{
“parameters”: {},
“id”: “8305406f-5d23-4da9-aea2-0640d0ab9b16”,
“name”: “When clicking ‘Test workflow’”,
“type”: “n8n-nodes-base.manualTrigger”,
“typeVersion”: 1,
“position”: [
400,
520
]
},
{
“parameters”: {
“method”: “POST”,
“url”: “https://192.168.1.2/api/project/1/tasks”,
“sendHeaders”: true,
“headerParameters”: {
“parameters”: [
{
“name”: “Accept”,
“value”: “application/json”
},
{
“name”: “Authorization”,
“value”: “Bearer cjlwoqs3g5cqmge91kfrl9fyqy1qfjlnmrus0wvlqns=”
}
]
},
“sendBody”: true,
“bodyParameters”: {
“parameters”: [
{
“name”: “template_id”,
“value”: “7”
}
]
},
“options”: {
“allowUnauthorizedCerts”: true
}
},
“id”: “1a6218c7-4e66-4ebc-8e4e-b9f5784ebd55”,
“name”: “HTTP Request2”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
1060,
520
]
}
],
“connections”: {
“When clicking ‘Test workflow’”: {
“main”: [
[
{
“node”: “HTTP Request2”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {}
}
Share the output returned by the last node
From HTTP Request
Error code
400
Full message
400 - ""
Request
{ "body": { "template_id": "7" }, "headers": { "accept": "application/json", "authorization": "**hidden**" }, "method": "POST", "uri": "https://192.168.1.2/api/project/1/tasks", "gzip": true, "rejectUnauthorized": false, "followRedirect": true, "resolveWithFullResponse": true, "followAllRedirects": true, "timeout": 300000, "encoding": null, "json": false, "useStream": true
Information on your n8n setup
- **n8n version :1.66.0
- **Database default:SQLite
- **n8n EXECUTIONS_PROCESS setting (default):default
- **Running n8n via:Dcoker
- **Operating system:Ubuntu Server 22.04.