Short answer
Open the browser console on the page with the map and find the error ending in MapError. RefererNotAllowedMapError means your site’s address isn’t on the key’s allowed websites. ApiNotActivatedMapError means the Maps JavaScript API isn’t enabled. BillingNotEnabledMapError means the project has no billing. InvalidKeyMapError means the key in the page isn’t recognised.
What each console error means, and the fix
01
RefererNotAllowedMapError: this website isn’t allowed to use the key
“The current URL loading the Maps JavaScript API has not been added to the list of allowed referrers.” Google, Maps JavaScript API error messages
The key has a website restriction and the address loading the map isn’t on it. This is why a map can work locally and fail live, or work on the live domain and fail on a preview URL. In the Cloud console, open the key and add every address that loads the map: the live domain, any www or preview domain, and your local address for development.
02
The allowed website is written in the wrong format
“Always provide the whole referrer string, including the protocol scheme, hostname and optional port” Google, Google Maps Platform security guidance
Write each entry with the scheme, host name and port if you use one, such as https://example.com, and use a wildcard like https://*.example.com to allow all subdomains. Google warns that most browsers strip the path from cross-origin requests, so an entry like https://example.com/some/path may not match.
03
ApiNotActivatedMapError: the Maps JavaScript API isn’t enabled
“The Maps JavaScript API is not activated on your API project.” Google, Maps JavaScript API error messages
The key belongs to a project where the Maps JavaScript API was never turned on. Enable it under APIs in the Cloud console for the same project the key comes from. If the console shows ApiTargetBlockedMapError instead, the key’s API restrictions leave this API out: add it to the key’s list of allowed APIs.
04
BillingNotEnabledMapError: the project has no billing account
“You have not enabled billing on your project which is causing this error.” Google, Maps JavaScript API error messages
Google requires billing on the project behind the key. Link a billing account to that Cloud project, then reload the page.
05
InvalidKeyMapError: the key in the page is wrong
“The API key included in the script element that loads the API is not found. Please make sure you are using a correct API key.” Google, Maps JavaScript API error messages
The key in the script tag doesn’t match a real key. In our experience this is often a key that was never set in the host’s environment variables, so the live build sends an empty or placeholder value. Compare the key in the page source with the one in the Cloud console.
Checked against the vendor’s docs on : Google Maps Platform: Maps JavaScript API error messages; Google Maps Platform: API security best practices.
Rather hand it over?
Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.
- from $450App Fix TicketOne reproducible bug in an existing mobile or web app, diagnosed and fixed.See scope and start
- from $450AI-Built App RescueA Lovable, Bolt or Cursor app checked end to end in 3 days, then its worst problems fixed at a fixed price.No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way.See scope and start
Related: Environment variables undefined on Vercel · Unexpected Google API charges