flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

šŸ› [firebase_storage/channel_error] Unable to establish connection on channel.

Open lmignini opened this issue 1 year ago • 4 comments

Bug report

Trying to access an image from Firebase Storage gives an error everytime I try to access, with any path.

In the rules:

service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read: if true;
      allow write: if false;
    }
  }
}

Using Flutter's future builder when calling this function gives the error in the title which i can't find anything about online except for a closed issue here.

Sample project

FirebaseStorage storage = FirebaseStorage.instance;
Future<Widget> displayImage(String documentId) async {
  print(storage.app.name);
  Reference imageLink =
      storage.ref("ao.jpg"); // this image exists! doesn't work with any path
  print(imageLink);
  final imageUrl = await imageLink.getDownloadURL(); // errors here i think becasue imageUrl doesn't get printed
  print(imageUrl);
  return Image.network(
    imageUrl.toString(),
    errorBuilder: (context, error, stackTrace) => const SizedBox(
      width: 0,
      height: 0,
    ),
  );
}

Function gets called here

  widgets.add(FutureBuilder<Widget>(
    future: displayImage(documentId),
    builder: (context, snapshot) {
      if (snapshot.hasData) {
        return (snapshot.data!);
      } else if (snapshot.hasError) {
        return Text('${snapshot.error}'); // this line prints the error
      }

      // By default, show a loading spinner.
      return const CircularProgressIndicator();
    },
  ));

lmignini avatar Jan 29 '24 22:01 lmignini

@sickleox2 What platform are you seeing this behavior on ? I tried with firebase_storage plugin example on Android and it seems to be working fine upon uploading a file. Can you try the same and check if using it, you still get the same error or not ?

darshankawar avatar Jan 30 '24 10:01 darshankawar

I’m using the iOS simulator.

lmignini avatar Jan 30 '24 10:01 lmignini

I tried with firebase_storage plugin example on Android and it seems to be working fine upon uploading a file. Can you try the same and check if using it, you still get the same error or not ?

Did you get a chance to check this ?

darshankawar avatar Jan 30 '24 11:01 darshankawar

Hey @sickleox2. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot avatar Feb 08 '24 02:02 google-oss-bot

Since there haven't been any recent updates here, I am going to close this issue.

@sickleox2 if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

google-oss-bot avatar Feb 19 '24 02:02 google-oss-bot