Need help to fix a simple text extract workflow

Describe the problem/error/question

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

Unable to connect to n8n’s AI service (Unexpected token ‘<’, "<!DOCTYPE "… is not valid JSON)

Information on your n8n setup

  • n8n version:
  • i need help to fix this workflow
    it gets an image/doc and extracts trext

(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.