(Unexpected token ‘<’, "<!DOCTYPE "… is not valid JSON) is normally a sign that you receive an error message from ( i guess) your Extract Fields Post request. The MAp fields js awaits data in JSON format but it gets Html (The error message from the previous node) Check the Post request to gemini AI, especially, URL, Authorization settings etc.
| Field | Value |
|---|---|
| Method | POST |
| URL | https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key={{$env.GOOGLE_API_KEY}} |
| Headers | Content-Type: application/json |
| Body | { "contents": [ { "parts": [ { "text": "Hello from n8n!" } ] } ] } |
| Authentication | None (since key is in URL) |
this could solve the problem or use header auth for Authentication, setting api key and content type.