Describe the problem/error/question
I’ve an API, I’m making POST request to it, and I’m getting domainsCount and domainsList in response. Now I’m trying to check if the URL I’ve got is valid or not valid or it redirects.
What is the error message (if any)?
I’m getting this error at the Clean URL (Http Node )
{
"meta": {
"instanceId": "0a422814530ee25bdff1426ee51f135e37f33752b29414f2c108179bca6ef312"
},
"nodes": [
{
"parameters": {
"url": "={{ $json.cleanUrl }}",
"options": {
"redirect": {
"redirect": {
"maxRedirects": 30
}
},
"timeout": 60000
}
},
"id": "1cef7768-3e09-4f99-a2e3-b9834568926c",
"name": "Clean URL - Visit Website",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1020,
340
]
}
],
"connections": {},
"pinData": {}
}
## Please share your workflow
{
"meta": {
"instanceId": "0a422814530ee25bdff1426ee51f135e37f33752b29414f2c108179bca6ef312"
},
"nodes": [
{
"parameters": {},
"id": "14004972-8a31-41d1-bec4-7f3d58a53e79",
"name": "When clicking ‘Test workflow’",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
0,
380
]
},
{
"parameters": {
"operation": "appendOrUpdate",
"documentId": {
"__rl": true,
"value": "1vSqTnX3w6iudQrbStut8RsV4ck1-Gn-ZeFEGDG8kyxE",
"mode": "id"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "domainslist",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vSqTnX3w6iudQrbStut8RsV4ck1-Gn-ZeFEGDG8kyxE/edit#gid=0"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"Original URL": "{{ $json[\"results\"][0].originalDomain }}",
"Final URL ": "{{ $json[\"results\"][0].finalURL }}",
"Status Code": "{{ $json[\"results\"][0].statusCode }}"
},
"matchingColumns": [
"Original URL"
],
"schema": [
{
"id": "Original URL",
"displayName": "Original URL",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "Final URL ",
"displayName": "Final URL ",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "Status Code",
"displayName": "Status Code",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
}
]
},
"options": {
"cellFormat": "USER_ENTERED"
}
},
"id": "8d1d9c8c-4f50-4c9d-aaa9-091234fa94e7",
"name": "Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.4,
"position": [
2060,
340
],
"credentials": {
"googleSheetsOAuth2Api": {
"id": "IPZqQqwd1blNWdt2",
"name": "Google Sheets account"
}
}
},
{
"parameters": {
"method": "POST",
"url": "https://maskedurl.com/api/v1",
"sendQuery": true,
"specifyQuery": "json",
"jsonQuery": "{\n \"apiKey\": \"at_9OXmjQ3DMj049UJ4WJ9Fzo21TjS25\",\n \"sinceDate\": \"2024-06-27\",\n \"subdomains\": {\n \"include\": [\n \"inst\"\n ]\n }\n}\n",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{}
]
},
"options": {}
},
"id": "2ad1a315-3eb6-4270-9c7c-a82102d88e15",
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
220,
620
]
},
{
"parameters": {
"jsCode": "const domains = items[0].json.domainsList;\nreturn domains.map(domain => {\n return { json: { cleanUrl: domain.replace('inst.', '') } };\n});\n"
},
"id": "d4a3cb01-898b-40ac-ab44-005e7c79c26d",
"name": "Remove inst from URL",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
520,
520
]
},
{
"parameters": {
"batchSize": 10,
"options": {
"reset": false
}
},
"id": "c968b780-a3f5-4304-bdae-6f8c0c943530",
"name": "Loop Over Items",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 3,
"position": [
760,
580
]
},
{
"parameters": {
"mode": "combine",
"mergeByFields": {
"values": [
{}
]
},
"options": {}
},
"id": "f70ed949-b064-44d7-b3df-e97d49bae180",
"name": "Merge",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.1,
"position": [
1820,
340
]
},
{
"parameters": {
"jsCode": "for (const item of items) {\n if (item.json.error) {\n // Handle connection refused or other errors\n item.json.status = \"Connection failed\";\n item.json.statusCode = null;\n item.json.cleanUrl = null;\n } else if (item.json.statusCode >= 200 && item.json.statusCode < 300) {\n if (item.json.url === item.json.cleanUrl) {\n item.json.status = \"Works without redirect\";\n } else {\n item.json.status = \"Works with redirect\";\n item.json.finalUrl = item.json.cleanUrl;\n }\n } else {\n item.json.status = \"Doesn't work\";\n }\n}\nreturn items;"
},
"id": "b8e3b791-3583-4cb1-9afb-35840b7f7dba",
"name": "final check",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1520,
340
]
},
{
"parameters": {
"url": "={{ $json.cleanUrl }}",
"options": {
"redirect": {
"redirect": {
"maxRedirects": 30
}
},
"timeout": 60000
}
},
"id": "1cef7768-3e09-4f99-a2e3-b9834568926c",
"name": "Clean URL - Visit Website",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1020,
340
]
}
],
"connections": {
"When clicking ‘Test workflow’": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "Remove inst from URL",
"type": "main",
"index": 0
}
]
]
},
"Remove inst from URL": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[
{
"node": "Clean URL - Visit Website",
"type": "main",
"index": 0
}
],
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Google Sheets",
"type": "main",
"index": 0
}
]
]
},
"final check": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Clean URL - Visit Website": {
"main": [
[
{
"node": "final check",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {}
}
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
## Share the output returned by the last node
{
"errorMessage": "The service refused the connection - perhaps it is offline [item 0]",
"errorDetails": {
"rawErrorMessage": [
"connect ECONNREFUSED ::1:80"
],
"httpCode": "rejected"
},
"n8nDetails": {
"nodeName": "Clean URL",
"nodeType": "n8n-nodes-base.httpRequest",
"nodeVersion": 4.2,
"itemIndex": 0,
"time": "7/5/2024, 10:59:21 AM",
"n8nVersion": "1.47.3 (Cloud)",
"binaryDataMode": "filesystem",
"stackTrace": [
"NodeApiError: The service refused the connection - perhaps it is offline",
" at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest/V3/HttpRequestV3.node.js:1634:35)",
" at processTicksAndRejections (node:internal/process/task_queues:95:5)",
" at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:728:19)",
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:664:51",
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1076:20"
]
}
}
Information on your n8n setup
- n8n version: 1.47.3 (Cloud)
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app): Cloud
- Operating system: Windows