flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

I/flutter (26641): Error fetching file: [firebase_storage/channel-error] Unable to establish connection on channel.

Open voltohmmeter opened this issue 10 months ago • 6 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues.

Which plugins are affected?

Storage

Which platforms are affected?

Android

Description

i constantly having this error log I/flutter (26641): Error fetching file: [firebase_storage/channel-error] Unable to establish connection on channel.

Reproducing the issue

this is the function that i am using firebase storage. The logic says that if the recognized word will be fetch in the storage corresponds a gif file.

void _onResult(SpeechRecognitionResult result) {
    setState(() {
      _wordsSpoken = result.recognizedWords;
      _confidenceLevel = result.confidence;
    });

    // Cancel the existing timer before starting a new one
    _speechTimeout.cancel();

    // Start a new timer if speech recognition is successful
    if (_confidenceLevel > 0) {
      _speechTimeout = Timer(const Duration(seconds: 2), () {
        _stopListening();
        // Fetch the URL after the timer stops
        String filePath =
            'gs://flutter-fsl.appspot.com/signlanguage/${_wordsSpoken.replaceAll(' ', ' ')}.gif';
        fetchFileFromStorage(filePath);
      });
    }
  }

  // void _onSubmitted(String value) {
  //   // Construct path based on the search query
  //   String filePath =
  //       'gs://salin-fsl.appspot.com/signlanguage/${value.replaceAll(' ', ' ')}.gif';
  //   fetchFileFromStorage(filePath);
  // }

  Future<void> fetchFileFromStorage(String filePath) async {
    // Check if the spoken word is not empty and the timer has stopped
    if (_wordsSpoken.isNotEmpty && !_speechTimeout.isActive) {
      try {
        final ref = FirebaseStorage.instance.ref(filePath);
        final url = await ref.getDownloadURL();

        // Set the URL to display after fetching
        setState(() {
          _imageUrl = url;
        });
        {
          print('File URL: $url');
        }
      } catch (e) {
        print('Error fetching file: $e');
        print('Word Spoken: $_wordsSpoken');
      }
    }
  }

Firebase Core version

2.29.0

Flutter Version

3.19.5

Relevant Log Output

A Dart VM Service on Infinix X688B is available at: http://127.0.0.1:64310/yEqcEgkQOBE=/
D/ApplicationPackageManager(26641): [getText] isMxtcMarket: false
I/chatty  (26641): uid=10259(com.example.flutter_fsl) identical 2 lines
D/ApplicationPackageManager(26641): [getText] isMxtcMarket: false
I/ple.flutter_fs(26641): Compiler allocated 4303KB to compile void android.view.ViewRootImpl.performTraversals()
The Flutter DevTools debugger and profiler on Infinix X688B is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:64310/yEqcEgkQOBE=/
I/flutter (26641): Error fetching file: [firebase_storage/channel-error] Unable to establish connection on channel.
I/flutter (26641): Word Spoken: hello

Flutter dependencies

dependencies: flutter: sdk: flutter

The following adds the Cupertino Icons font to your application.

Use with the CupertinoIcons class for iOS style icons.

cupertino_icons: ^1.0.2 rive: ^0.13.1 flutter_svg: ^2.0.10+1 firebase_core: ^2.29.0 avatar_glow: ^3.0.1 speech_to_text: ^6.4.0 firebase_storage: ^11.7.1 flutter_gif: ^0.0.4 get: ^4.1.4 appinio_video_player: ^1.3.0 cloud_firestore: ^4.16.1 http: ^1.2.1

Additional context and comments

Future main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, );

runApp(const MyApp()); }

voltohmmeter avatar Apr 15 '24 11:04 voltohmmeter

Hello @voltohmmeter,

Could you try running flutter clean and then test it again?

TarekkMA avatar Apr 15 '24 13:04 TarekkMA

i tried to flutter clean so many times but it does not do anything sir

voltohmmeter avatar Apr 15 '24 22:04 voltohmmeter

i will provide my initialization import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb, TargetPlatform;

/// Default [FirebaseOptions] for use with your Firebase apps. /// /// Example: /// dart /// import 'firebase_options.dart'; /// // ... /// await Firebase.initializeApp( /// options: DefaultFirebaseOptions.currentPlatform, /// ); /// class DefaultFirebaseOptions { static FirebaseOptions get currentPlatform { if (kIsWeb) { return web; } switch (defaultTargetPlatform) { case TargetPlatform.android: return android; case TargetPlatform.iOS: return ios; case TargetPlatform.macOS: return macos; case TargetPlatform.windows: throw UnsupportedError( 'DefaultFirebaseOptions have not been configured for windows - ' 'you can reconfigure this by running the FlutterFire CLI again.', ); case TargetPlatform.linux: throw UnsupportedError( 'DefaultFirebaseOptions have not been configured for linux - ' 'you can reconfigure this by running the FlutterFire CLI again.', ); default: throw UnsupportedError( 'DefaultFirebaseOptions are not supported for this platform.', ); } }

static const FirebaseOptions web = FirebaseOptions( apiKey: 'AIzaSyBWsNdDlOQ0D-2x5YqA5fZjHx-l2Psk2-g', appId: '1:537937102884:web:055f7fd30f79d9f77bf0b1', messagingSenderId: '537937102884', projectId: 'flutter-fsl', authDomain: 'flutter-fsl.firebaseapp.com', // databaseURL: // 'https://flutterfire-e2e-tests-default-rtdb.europe-west1.firebasedatabase.app', storageBucket: 'flutter-fsl.appspot.com', );

static const FirebaseOptions android = FirebaseOptions( apiKey: 'AIzaSyBNM7z1fAUTo0-SNu2FB-FLbV5xoWj_XSY', appId: '1:537937102884:android:87af0929100f0d747bf0b1', messagingSenderId: '537937102884', projectId: 'flutter-fsl', // databaseURL: // 'https://flutterfire-e2e-tests-default-rtdb.europe-west1.firebasedatabase.app', storageBucket: 'flutter-fsl.appspot.com', );

static const FirebaseOptions ios = FirebaseOptions( apiKey: 'AIzaSyB-zv6bqUFduikmzZzyRzpf_l7WmsNGYUI', appId: '1:537937102884:ios:2800d8aa7d732b6c7bf0b1', messagingSenderId: '406099696497', projectId: 'flutter-fsl', // databaseURL: // 'https://flutterfire-e2e-tests-default-rtdb.europe-west1.firebasedatabase.app', storageBucket: 'flutter-fsl.appspot.com', // androidClientId: // '406099696497-17qn06u8a0dc717u8ul7s49ampk13lul.apps.googleusercontent.com', // iosClientId: // '406099696497-584r3j0bb2to4prgnjj2nfn1or1pqqbg.apps.googleusercontent.com', // iosBundleId: 'io.flutter.plugins.firebase.analytics.example', );

voltohmmeter avatar Apr 15 '24 23:04 voltohmmeter

any update on this issue

muhammedrashidm avatar May 06 '24 12:05 muhammedrashidm

@muhammedrashidm @voltohmmeter, is this issue happening also on the example app? I'm not able to reproduce this issue. if you could provide a minimal working example where I can recreate this issue this would be great.

TarekkMA avatar May 07 '24 13:05 TarekkMA

Hey @voltohmmeter. 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 May 16 '24 01:05 google-oss-bot

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

@voltohmmeter 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 May 27 '24 01:05 google-oss-bot