google / generative-ai-docs

Documentation for Google's Gen AI site - including the Gemini API and Gemma
https://ai.google.dev
Apache License 2.0
1.45k stars 492 forks source link

Only works locally #473

Open henriqueArrazao opened 6 days ago

henriqueArrazao commented 6 days ago

Description of the bug:

Nothing much to share, locally works fine and in the server not. Server is in Germany. I checked and the API KEY is being sent.

This is the log

Server is running on port 3000 🚀
/app/node_modules/@google/generative-ai/dist/index.js:353
            throw new GoogleGenerativeAIFetchError(`Error fetching from ${url.toString()}: [${response.status} ${response.statusText}] ${message}`, response.status, response.statusText, errorDetails);
                  ^

GoogleGenerativeAIFetchError: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent: [403 Forbidden] 
    at _makeRequestInternal (/app/node_modules/@google/generative-ai/dist/index.js:353:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async generateCon
```tent (/app/node_modules/@google/generative-ai/dist/index.js:752:22) {
  status: 403,
  statusText: 'Forbidden',
  errorDetails: undefined
}

Node.js v18.20.2

I tested the same Curl the lib requests in the Ubuntu terminal and it worked fine, so it's not a problem with the location.

After a lot of debugging got managed to get this new info:

Your client does not have permission to get URL /v1beta/models/gemini-1.5-flash:generateContent from this server. That’s all we know.

singhniraj08 commented 4 days ago

@henriqueArrazao Thank you reporting this issue. This repository is for issues related to website(https://ai.google.dev/) like documentation bugs or improvements. For issues related to Gemini API, we would suggest you to use "Send Feedback" option in Gemini docs. Ref: Screenshot below. You can also post this issue on Discourse forum.

image