Skip to content

🐛 [N/A] Unclear exception message when GCP Project ACLs do not permit access and throws Unhandled Exception: FormatException: Invalid envelope exception #7425

Closed
@zmeggyesi

Description

@zmeggyesi

Bug report

Describe the bug
GCP Project ACLs are not tied directly to the Firebase project, and a desync between the two can create a situation where Firebase calls fail for no apparent reason, and with no clear exception message.

Steps to reproduce

Steps to reproduce the behavior:

  1. Complete Firebase SDK setup
  2. Set up a set of credentials in GCP
  3. Restrict GCP credentials to limited set of APIs
  4. Restrict GCP credentials to a single platform (iOS or Android, should not matter)
  5. DO NOT specify a package signature, or specify an incorrect one
  6. See error or incorrect behavior

Expected behavior

I expect the exception thrown by the Firebase SDK to shed light on the nature of the error, or at least not misdirect me.

Sample project

N/A


Additional context

Continuation of #6993.

Although it's the Firebase SDK throwing the error, it's not actually the Firebase SDK that's at fault, nor is it Firebase itself. The problem originates in GCP, which has a separate ACL for the Firebase APIs, including Firebase Remote Config API (though I suspect the Installations API might also play a part, or any of the other Firebase APIs), and because the new package signature was not added in the GCP Credentials ACL, my requests were discarded with an error. This error was, however, not surfaced to me at any point.

So the problem in the referenced issue was not with Firebase itself, but how this particular scenario is communicated to the developer. Because there's a package signature filter both on the Firebase Console (which I remembered to update) and on the GCP Console (which I didn't), this looks more like a UX/architecture issue - which makes it all the thornier and harder to resolve.
My humble recommendation, without being aware of the internals, would be to present the developer with a more specific error message that indicates why the request failed. I realize there is a difficulty in differentiating a request that fails due to the Firebase ACL from one that fails due to GCP's ACL, but I believe it would be important to distinguish between the two.


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.5.3, on Microsoft Windows [Version 10.0.22000.348], locale hu-HU)
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[√] Chrome - develop for the web
[√] Android Studio (version 2020.3)
[√] IntelliJ IDEA Community Edition (version 2021.2)
[√] VS Code (version 1.62.3)
[√] Connected device (3 available)

• No issues found!

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand
firebase_core: 1.10.0
firebase_crashlytics: 2.3.0
firebase_analytics: 8.3.4
firebase_auth: 3.2.0
firebase_remote_config: 0.11.0+2
firebase_storage: 10.1.0


Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions