Hi n8n Community and Support Team,
I’m encountering a very stubborn issue with my n8n Cloud instance (URL: hayatechaofen.app.n8n.cloud
, Version: 1.100.1 (Cloud)
) when trying to make external API requests. My goal is to build a workflow that calls both the Google Gemini Generative Language API (for script generation) and the ElevenLabs Text-to-Speech API (for voiceovers).
Good News: The ElevenLabs Text-to-Speech API call is now successfully working within my n8n workflow, and the generated audio is correctly uploaded to Google Drive. This confirms my ElevenLabs API key, account, and the Google Drive connection are functioning.
The CURRENT persistent issue is specifically with the Google Gemini API call.
Problem Description (Focus on Gemini): I am attempting to send a POST
request with a JSON body to the Google Gemini API (using models/gemini-2.5-flash:generateContent
) from the first HTTP Request
node in my workflow. This request consistently fails.
Specific Issues Encountered:
- Using the
HTTP Request
Node (for Google Gemini API):
- Error: The node fails with a
400 Bad Request
andInvalid value at 'contents'
. The detailed API response from Google indicates that it’s receiving thecontents
value as a literal string (includingJSON.stringify(...)
and backslashes), instead of a pure JSON array/object. - Observation: This occurs despite configuring
Body Content Type
toJSON
andSpecify Body
toUsing Fields Below
, and providing the raw JavaScript array literal directly in theValue
field forcontents
(as per n8n documentation). It seems n8n is incorrectly serializing the JSON body.
- Using the
Code
Node (as an alternative for HTTP requests - for future needs):
- Error 1: When attempting to use the standard JavaScript
fetch
API within the Code node, the workflow fails with"fetch is not defined"
. - Error 2: When attempting to use n8n’s built-in
n8n.httpRequest
function within the Code node, the workflow fails with"n8n is not defined"
. - This suggests a highly restricted or misconfigured JavaScript runtime environment for the Code node on this instance, preventing any external HTTP calls from there.
- “Import cURL” Feature in
HTTP Request
Node:
- Error: When trying to import a working PowerShell
Invoke-RestMethod
script (which successfully calls Gemini externally), the “Import cURL” feature fails with"Couldn't import cURL command. This command is in an unsupported format"
. This implies it cannot parse PowerShell syntax.
Troubleshooting Steps Already Taken:
- External API Tests (Successful for both Gemini & ElevenLabs via PowerShell):
- Successfully called ElevenLabs API via PowerShell, confirming API key, setup, and binary audio output.
- Successfully called Google Gemini API via PowerShell (for a simple prompt) using
Invoke-RestMethod
, confirming API key and basic connection. Also successfully generated the full script usingInvoke-RestMethod
in PowerShell. This confirms both APIs work externally.
- API Keys & Accounts: Tried multiple ElevenLabs API keys (including a paid subscription key) and multiple Google Gemini API keys (newly generated from different projects).
- Voice IDs & Models: Tested with various voice IDs (Bella, Daniel) and Gemini models (gemini-pro, gemini-2.5-flash).
- Google Drive Connection (WORKING): Successfully connected and uploaded files to Google Drive, resolving
403 Forbidden
errors for OAuth scopes and403 Access Blocked
for test user configuration. - n8n UI & Cache: Performed multiple hard refreshes of the n8n UI and cleared browser cache/cookies for the n8n domain.
- n8n Logs: The live “Logs” panel at the bottom of the n8n UI consistently shows “Nothing to display yet” even when an error occurs. Detailed errors can only be retrieved from the “Executions” tab history.
It appears there is a fundamental and persistent issue with how my specific n8n Cloud instance handles external HTTP requests (especially with complex JSON bodies) from the HTTP Request
node, and also its Code
node’s runtime environment.
I have working API keys and can provide them privately if requested by support.
Any assistance in diagnosing and resolving these issues would be greatly appreciated.
Thank you!
Best regards,
Hayate