My code is working fine on localhost, I am using google-map-react package to render map on my react app but when i merged the code in QA or PROD environment the map gets loaded for a second and then it says error and when i check the console windows it says "InvalidKeyMapError" even though i have provided the API key.
Here is my code:
import React, { useState } from 'react';
import GoogleMapReact from 'google-map-react';
import Marker from './marker';
import APIUrls from "../../../services/urls";
const GoogleMap = (props) => {
const defaultCenter = {
lat: 59.95,
lng: 30.33
}
const center = {
lat: 59.95,
lng: 30.33
}
const zoom= 11
return (
<div style={{ height: '100vh', width: '100%' }}>
<GoogleMapReact
yesIWantToUseGoogleMapApiInternals
bootstrapURLKeys={{ key: APIUrls.googleMapsAPIKey }}
defaultCenter={defaultCenter}
defaultZoom={zoom}
center={center}
>
<Marker
lat={59.955413}
lng={30.337844}
text="My Marker"
/>
</GoogleMapReact>
</div>
);
}
export default GoogleMap;