Google APIs — Verification Checklist
Confirm that Maps, Places, Geocoding, and Gemini are all working correctly before connecting them to real features.
Before connecting any Google API to real app features, verify each one independently. A problem caught here takes 2 minutes to fix. The same problem discovered halfway through building a feature takes 30 minutes to trace back to the API setup.
Work through each section in order. Do not skip ahead.
Google Cloud Setup
These are prerequisites. If any of these are not done, the API calls will fail regardless of how correctly your code is written.
- Google Cloud project exists — you can see it in the top dropdown at console.cloud.google.com
- Billing account is attached — console.cloud.google.com → Billing → confirm a billing account is linked to the project (a payment method is required even for the free tier)
- Billing alert is set — Billing → Budgets & Alerts → a budget alert exists at $10 or similar, so you receive an email before any unexpected charge
- Maps JavaScript API is enabled — APIs & Services → Enabled APIs → "Maps JavaScript API" appears in the list
- Places API is enabled — "Places API" appears in the Enabled APIs list
- Geocoding API is enabled — "Geocoding API" appears in the Enabled APIs list
- Generative Language API is enabled — "Generative Language API" (Gemini) appears in the list
API Key Configuration
- An API key exists — APIs & Services → Credentials → at least one API key is listed
- The Maps/Places/Geocoding key has domain restrictions set — click the key → "Application restrictions" → "HTTP referrers" → your domains are listed (e.g.
localhost:*for development, your Vercel domain for production) - The Maps key is in your
.envfile — your web project's.envor.env.localcontainsNEXT_PUBLIC_GOOGLE_MAPS_API_KEY=AIzaSy...(orVITE_GOOGLE_MAPS_API_KEY=for Vite projects) - The Gemini key is in Supabase secrets — run
npx supabase secrets list→GEMINI_API_KEYappears (do NOT put the Gemini key in.env) -
.envis in.gitignore— confirm your environment file is not tracked by git (git statusshould not show.envas a new or modified file)
Maps JavaScript API
Test: a map renders in your app.
Create a test page or component with the minimal map code from the Maps API page. Open it in your browser.
- No console errors — open the browser DevTools console (F12 → Console tab). There should be no red errors. Common errors at this stage:
Google Maps JavaScript API error: RefererNotAllowedMapError→ your domain isn't in the key's HTTP referrer restrictions — addlocalhost:*for developmentGoogle Maps JavaScript API error: ApiNotActivatedMapError→ the Maps JavaScript API isn't enabled in Cloud ConsoleGoogle Maps JavaScript API error: InvalidKeyMapError→ the key in your.envdoesn't match what's in Cloud Console
- Map renders visually — you can see the Google Maps tiles (the actual map image) in the browser
- Map is interactive — you can click and drag to pan, scroll to zoom
- A marker appears — if you added a
<Marker>component, the pin is visible at the correct coordinates
Places API (Address Autocomplete)
Test: the autocomplete shows suggestions when you type.
Add the AddressAutocomplete component from the Places & Geocoding page to a test page. Type a partial address.
- Suggestions appear after 2–3 characters — typing "Ban" should show suggestions like "Banjara Hills, Hyderabad, Telangana, India"
- Suggestions are restricted to India — you should not see results from the UK, USA, or other countries (confirms
componentRestrictions: { country: 'in' }is working) - Selecting a suggestion fires the callback — click a suggestion and confirm your
onAddressSelectedcallback receives the{ formatted, lat, lng }object (log it to the console to verify) - Coordinates are numbers, not strings —
typeof lat === 'number'should be true. If you get"17.4126"(a string in quotes) instead of17.4126, check whether you are calling.lat()as a function (for theAutocompletecomponent) vs reading.latas a property (for the mobile library)
Geocoding API
Test: converting an address string to coordinates.
Run the geocodeAddress function from the Places & Geocoding page (or use the edge function test below) with a known address.
Quick browser test (paste into DevTools console, after the Maps SDK has loaded):
Expected output:
- Status is
OK— any other status (ZERO_RESULTS, REQUEST_DENIED, OVER_QUERY_LIMIT) indicates a setup problem - Coordinates are in the expected range for India — latitude should be between 8 and 37, longitude between 68 and 98
- Edge function geocoding works — if you have built the server-side geocoding edge function, test it with
supabase functions servelocally and call it with a test address
Gemini API
Test: the edge function returns AI-generated text.
Use supabase functions serve to run your edge function locally, then call it with test data.
Local test (run in a new terminal after npx supabase functions serve):
Expected response:
- The edge function starts without errors —
supabase functions serveoutput should show the function loaded, not a Deno compile error - The API call succeeds — response HTTP status is 200
-
GEMINI_API_KEYis accessible in the function — if you get aTypeError: Cannot read properties of undefinedon thegenAIline, the secret is not set. Runnpx supabase secrets set GEMINI_API_KEY=your_key_hereand restart functions serve - The response contains a bio — the returned text is coherent, professional, and relevant to the input
- The function requires authentication — call it without the
Authorizationheader and confirm you receive a 401 response (not a 200)
Mobile (React Native / Expo)
If you are working on the Expo mobile app:
-
react-native-mapsrenders a map — the MapView component shows Google Maps tiles on Android - API key is in
app.jsonunderexpo.android.config.googleMaps.apiKey -
react-native-google-places-autocompleteshows suggestions — typing in the autocomplete input shows Place suggestions -
fetchDetails={true}returns coordinates — selecting a suggestion logs both the description and thegeometry.locationobject
Test on a physical Android device, not the emulator, for the Places autocomplete. The Google Play Services integration that the Places library relies on works more reliably on real hardware. If autocomplete works on a device but not the emulator, this is the reason.
Common Failure Modes (Reference)
| Symptom | Most likely cause | Fix |
|---|---|---|
| Map shows grey tiles or no tiles | API key invalid or Maps API not enabled | Check Cloud Console → Credentials and Enabled APIs |
| "RefererNotAllowedMapError" | localhost not in HTTP referrer restrictions | Add localhost:* to the key's allowed referrers |
| Autocomplete shows no results | Places API not enabled on the key | Enable Places API in Cloud Console |
| Autocomplete shows global results | componentRestrictions not set | Add { country: 'in' } to the options |
| Coordinates returned as strings | Wrong property access pattern | Use .lat() function call, not .lat property read (for the @react-google-maps/api Autocomplete) |
| Gemini returns 403 | API key doesn't have Generative Language API enabled | Enable in Cloud Console → APIs & Services → Library |
| Gemini edge function returns undefined | GEMINI_API_KEY secret not set | Run npx supabase secrets set GEMINI_API_KEY=... |
| Gemini response can't be JSON parsed | Gemini wrapped JSON in markdown fences | Strip ```json and ``` before calling JSON.parse() |
Before Moving On
All items above should be checked before connecting any Google API to a real feature in your app. A working API call in isolation is the proof that your setup is correct. Problems discovered at this stage are configuration problems — fast to fix. The same problems discovered while building a feature are buried under layers of component code and take much longer to find.
Once all checks pass, you are ready to use these APIs in real features.