When deploying Gemini Pro Chat on Vercel, some users might encounter the error “User location is not supported for the API use”. This issue arises due to certain Vercel edge function nodes being in locations not supported by Google. While Gemini Pro Chat, based on the Astro 2 framework, doesn’t support modifying edge function locations, there’s a workaround involving the use of a proxy, specifically the palm proxy, which is based on the Next.js framework.
Table of contents
Open Table of contents
Understanding the Issue
The issue stems from Vercel’s edge function nodes being located in regions unsupported by Google’s API. Since Astro 2, the framework used by Gemini Pro Chat, does not allow changing the edge function location, a different approach is needed.
Deploying Palm Proxy
- Visit the palm-proxy repository.
- Click the “Deploy With Vercel” button.
- After deployment, Vercel will assign a domain (e.g.,
https://xxx.vercel.app
).
Configuring Gemini Pro Chat
- In your Gemini Pro Chat project settings on Vercel, add a new environment variable named
API_BASE_URL
. - Set the value of
API_BASE_URL
to the domain you received from the palm proxy deployment (https://xxx.vercel.app
).
Finalizing the Deployment
- Redeploy your Gemini Pro Chat project on Vercel.
- This setup should circumvent the location issue by routing API requests through the palm proxy.
Special thanks to antergone for providing this solution. By following these steps, you can successfully deploy Gemini Pro Chat on Vercel without encountering the “User location is not supported for the API use” error.