Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [FIREBASE_STORAGE] Different exceptions across platforms (Android and iOS). #8113

Closed
yamauchieduardo opened this issue Feb 17, 2022 · 2 comments
Labels
plugin: storage resolution: duplicate This issue or pull request already exists type: documentation Improvements or additions to documentation type: enhancement New feature or request

Comments

@yamauchieduardo
Copy link

yamauchieduardo commented Feb 17, 2022

I notice different errors/exceptions across the Platform when a Firebase Storage deny access, like the issue #8066 but using Firebase Storage.

The exceptions are different by the platform Android and iOS.

This occurs in two cases:

The first case happen when a User WITH AUTORIZATION (by Firebase Storage Rules) try to read a file that DOESN'T EXIST a PlatormException is throw.

Using Android emulator/physical device:

PlatformException(
  code: "object-not-found",
  message: "com.google.firebase.storage.StorageException: Object does not exist at location.",
  details: {"message": "No object exists at the desired reference."},
);
Debug image

arquivo não existe e usuário tem autorização de leitura Android

Using iOS emulator/physical device:

PlatformException(
  code: "firebase_storage",
  message: "No object exists at the desired reference.",
  details: {"message": "No object exists at the desired reference."},
);
Debug image

arquivo não existe e usuário tem autorização de leitura iOS

The second case happen when a User WITHOUT AUTORIZATION (by Firebase Storage Rules) try to read a file that EXIST a PlatormException is throw.

Using Android emulator/physical device:

PlatformException(
  code: "firebase_storage",
  message: "com.google.firebase.storage.StorageException: User does not have permission to access this object.",
  details: {
    "code": "unauthorized",
    "message": "User is not authorized to perform the desired action."
  },
);
Debug image

arquivo existe, mas usuario não tem autorização de leitura Android

Using iOS emulator/physical device:

PlatformException(
  code: "unauthorized",
  message: "User is not authorized to perform the desired action.",
  details: {"message": "User is not authorized to perform the desired action."},
);
Debug image

arquivo existe, mas usuario não tem autorização de leitura iOS

I'm aways use the exception code to know the type of exception. Could be nice normalize these exceptions to record or analyze better using tools like analytics, etc.

Adicional information: I test a lot of cases to validade if the Firebase Rules are working in a real scenario using the emulators and devices, and these are the unique cases that throw PlatformException instead FirebaseException.

firebase_storage: ^10.2.7
flutter version: 2.10.

Regards.

@yamauchieduardo yamauchieduardo added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Feb 17, 2022
@darshankawar darshankawar added the triage Issue is currently being triaged. label Feb 18, 2022
@darshankawar
Copy link

Thanks for the report. I'll treat this more of a documentation and enhancement issue to make the platformexception messages similar across android and iOS. Similar to #8066.

/cc @russellwheatley

@darshankawar darshankawar added plugin: storage type: documentation Improvements or additions to documentation type: enhancement New feature or request and removed type: bug Something isn't working Needs Attention This issue needs maintainer attention. triage Issue is currently being triaged. labels Feb 18, 2022
@russellwheatley
Copy link
Member

Closing this out for an issue that already tracks Storage exception message handling: #7474

@darshankawar darshankawar added the resolution: duplicate This issue or pull request already exists label Jan 5, 2024
@firebase firebase locked and limited conversation to collaborators Feb 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
plugin: storage resolution: duplicate This issue or pull request already exists type: documentation Improvements or additions to documentation type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants