Issue-Download Tiktok Video (RapidAPI) Invalid JSON

Describe the problem/error/question
I’m trying to use the “Download TikTok Video” node via RapidAPI in my n8n workflow. The node fails with an error related to invalid JSON, although I expected a proper API response.
The Step before is Trigger: Get TikTok URL via Telegram

What is the error message (if any)?
Invalid JSON in response body

Error: Invalid JSON in response body at jsonParse
at ExecuteContext.execute (…)

See attached screenshot for the full stack trace.
Please share your workflow
json
{
“nodes”: [
{
“parameters”: {
“url”: “https://tiktok-download-video1.p.rapidapi.com/getVideo?url={{ $json.message.text }}”,
“authentication”: “none”,
“sendHeaders”: true,
“headerParametersUi”: {
“parameter”: [
{
“name”: “x-rapidapi-host”,
“value”: “tiktok-download-video1.p.rapidapi.com
},
{
“name”: “x-rapidapi-key”,
“value”: “<MY_API_KEY>”
}
]
}
},
“name”: “Download TikTok Video”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 3,
“position”: [720, 300]
}
]
}
Share the output returned by the last node
Invalid JSON in response body
The node fails because the API response is not in proper JSON format, possibly due to:
• HTML being returned (e.g. 403 or 404 error page),
• or the TikTok URL is malformed or no longer supported by the API.
Information on your n8n setup
• n8n version: 1.94.1 (Self Hosted)
• Database (default: SQLite): Default

1 Like

Hey @Greg1,

I’d love to help, but it looks like the workflow code you’ve pasted isn’t quite correct.

Could you please share the actual workflow again, making sure it’s properly formatted?
Tip: You can insert your workflow by clicking the </> button and pasting in the workflow’s code.

Also, it would be really helpful if you could pin the data in the relevant node(s), so we can better understand what’s going wrong and debug more effectively.

For pinning the data you can first execute the node and and from the output click on the pin icon.

Thanks!

Hey @Greg1

You can do it like this

I even added the part to download it via extracting the url provided.

Hope this helps,

Samuel

Thanks Subhanshu Sharma, for your support. I am beginning on n8n. your support is more than helpful.
Below my source code + error message - in attachment the workflow + http request
what is it wrong ? thanks for your advise

INPUT
[
  {
    "update_id": 780675008,
    "message": {
      "message_id": 27,
      "from": {
        "id": 7060732766,
        "is_bot": false,
        "first_name": "blue",
        "last_name": "bay",
        "language_code": "fr"
      },
      "chat": {
        "id": 7060732766,
        "first_name": "blue",
        "last_name": "bay",
        "type": "private"
      },
      "date": 1748891922,
      "text": "https://www.tiktok.com/@sabrina_ramonov/video/7501351096644832542?q=SABRINA%20RAMONOV&t=1748497255190",
      "entities": [
        {
          "offset": 0,
          "length": 101,
          "type": "url"
        }
      ],
      "link_preview_options": {
        "url": "https://www.tiktok.com/@sabrina_ramonov/video/7501351096644832542?q=SABRINA%20RAMONOV&t=1748497255190"
      }
    }
  }
]

 
{
  "errorMessage": "Invalid JSON in response body",
  "errorDetails": {},
  "n8nDetails": {
    "n8nVersion": "1.94.1 (Self Hosted)",
    "binaryDataMode": "default",
    "stackTrace": [
      "Error: Invalid JSON in response body",
      "    at jsonParse (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-workflow@file+packages+workflow/node_modules/n8n-workflow/src/utils.ts:147:10)",
      "    at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_12b981d6b49d407a163f4d5244314033/node_modules/n8n-nodes-base/nodes/HttpRequest/V3/HttpRequestV3.node.ts:837:24)",
      "    at processTicksAndRejections (node:internal/process/task_queues:95:5)",
      "    at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@[email protected][email protected][email protected]_/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1185:9)",
      "    at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@[email protected][email protected][email protected]_/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1534:27",
      "    at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@[email protected][email protected][email protected]_/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2098:11"
    ]
  }
}

![WorkFlow_HTTP|657x500](upload://1aIM4NjqCozef3vr9qaWw1HXO9d.png)

Thanks Samuel, for your proposal - it provide me the same issue - but not idea how to solve it :frowning:

@Greg1

Did you want to jump on a call? We can try call outside n8n see what results you get, it worked first time for me :confused: let me know, we can use discord google meet?

feel free to join.

Samuel

@Greg1

Thank you for meeting, to confirm we used split('?q=')[0 I think it was, which removed the unneeded query parm from the url which is shared via telegram.

Please do mark as solution and feel free to reach out if anything further comes up.

Many thanks,

Samuel

2 Likes

Huge thanks to Samuel for your greatly appreciated help this evening!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.