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.62k stars 569 forks source link

Gemini REST API implemented in NodeJs application works on localhost but fails in production #258

Open petrong opened 7 months ago

petrong commented 7 months ago

Description of the bug:

Gemini REST API implemented in NodeJs application works on localhost but fails in production. Returns 502 error seen below

Gemini endpoint used: https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=$API_KEY

Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request

Reason: Error reading from remote server

Error log in server Apache Ubuntu 20.04 gives

[proxy_http:error] [pid 756595] (70007)The timeout specified has expired: ....AH01102: error reading status line from remote server localhost:5001 [proxy:error] [pid 756595] ...AH00898: Error reading from remote server returned by /gig/geminize

Can I get any help to resolve this urgently please?

Thanks

Actual vs expected behavior:

No response

Any other information you'd like to share?

No response

petrong commented 7 months ago

So I attempted to send this API request to Gemini API via my server terminal..

like this:

sudo curl -X POST -H "Content-Type: application/json" -d '{"contents": [{
"parts":[{"text": "Write a story about the Christian faith."}]}]}' "https://generativelanguage.googleapis.com/v1beta/mod
els/gemini-pro:generateContent?key=API_KEY"

and here was the outcome:

{
  "error": {
    "code": 400,
    "message": "User location is not supported for the API use.",
    "status": "FAILED_PRECONDITION"
  }
}

My server location is England, so I asked Google Bard the below:

Is Gemini REST API supported in England?

The reponse:

As of today, February 14, 2024, the Gemini REST API is not currently supported in England.

  • Reason: Gemini temporarily disabled all API functionalities for UK customers on November 22nd, 2023 to comply with the UK Travel Rule.
  • Expected time frame: They are working to re-enable the API with compliant features and aim to resume service in January 2024. However, due to today's date, it seems that the service hasn't resumed yet.

Here are some helpful resources:

Since I am trained on a massive dataset of text and code, I can offer different information depending on how you phrase your questions. As such, let me know if you have any further questions or need clarification on a specific aspect of the Gemini API's availability in England.

I critically need this API to implement live chat for an urgent project. Does this Google Bard response mean the end of the road for me?

Any help would be appreciated.

petrong commented 7 months ago

https://ai.google.dev/available_regions

Is there any workaround for me? Though my server is situated in England, I am not. I am in Africa

jeevanism commented 7 months ago
geminapi

It seems UK is out of the available regions list