Skip to content

šŸ› [FIREBASE_STORAGE] Different exceptions across platforms (Android and iOS).Ā #8113

Closed
@yamauchieduardo

Description

@yamauchieduardo

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions