After updating to the latest versions, I now see a 403 and warning during initialization
"index.esm.js:106 [2020-10-01T19:41:18.520Z] @firebase/analytics: Failed to fetch this Firebase app's measurement ID from the server. Falling back to the measurement ID XXXXXX provided in the "measurementId" field in the local Firebase config. [Analytics: Dynamic config fetch failed: [403] Requests to this API firebase.googleapis.com method google.firebase.service.v1alpha.DynamicConfigService.GetDynamicWebConfig are blocked. (analytics/config-fetch-failed).]"
I have tried granting access to all the following, but the error persists:
The config object does have a measurementID passed in, but the SDK seems to ignore this unless there is a failure. Nothing else was changed.
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Analytics was updated in 7.20.0 to dynamically retrieve the measurement ID from dynamic config and only fall back to the local config if the dynamic config fetch fails. See the release notes for more.
As for why the fetch is failing, let me check with the backend team about which API permissions you would need to enable.
If you are able to temporarily set it to no restrictions and let me know if the error goes away when you do that, that would be helpful. Maybe you could try it on another test project if that is a production project where you don't want to lift restrictions.
So the API you need to enable should be the Firebase Management API. Let me know if that solves the problem (also if it doesn't).
I also have one more question if you don't mind, did you manually restrict the API key on your project, or was it set up that way by default? If manually, can I ask why? I just want to see how likely other users are to run into this issue, and in which use cases.
Thanks so much! Adding Firebase Management API resolved the error.
We have our client side API key locked down as much as possible with website and API restrictions. With this being client side JS, this API key only has access to firebase and maps APIs.
The application behavior was unchanged and I found the PR with the updated logic, so I figured this was a callout to a new service that wasn't already enabled. It just wasn't clear what service would need to be enabled (you would think just remote config). It might be helpful to add a note to the changelog in case others run into the same issue. Thanks again for the help!
Most helpful comment
So the API you need to enable should be the
Firebase Management API. Let me know if that solves the problem (also if it doesn't).