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

TypeError: Cannot read properties of undefined (reading 'initIrisRtc') #1434

Closed
mdaniyal9 opened this issue Nov 14, 2023 · 9 comments
Closed
Labels
waiting for customer response waiting for customer response, or closed by no-reponse bot

Comments

@mdaniyal9
Copy link

Describe the bug
When i try to join channel from agora flutter web SDK it crashes. Can anyone tell me what i am doing wrong?

To Reproduce
Steps to reproduce the behavior:

  1. I have followed the steps in readme of agora flutter sdk repo
  2. I have also added <script src="iris-web-rtc_n423_w4182_0.3.0.js"></script> in index.html
  3. TypeError: Cannot read properties of undefined (reading 'initIrisRtc')
    packages/agora_rtc_engine/src/impl/platform/web/js_iris_api_engine_binding_delegate.dart 20:5 createApiEngine
    packages/iris_method_channel/src/platform/web/iris_method_channel_internal_web.dart 107:9 initilize
    dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
    dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 127:5 _async
    packages/iris_method_channel/src/platform/web/iris_method_channel_internal_web.dart 103:41 initilize
    packages/iris_method_channel/src/iris_method_channel.dart 48:42 initilize
    dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
    dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 127:5 _async
    packages/iris_method_channel/src/iris_method_channel.dart 40:41 initilize
    packages/agora_rtc_engine/src/impl/agora_rtc_engine_impl.dart 388:29 initialize$
    dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
    dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 127:5 _async
    packages/agora_rtc_engine/src/impl/agora_rtc_engine_impl.dart 364:26 initialize
    packages/go_router_example/pages/test-agora-call-new.dart 141:23 setupVideoSDKEngine

Expected behavior
As per documentation i should be able to join a channel

Desktop (please complete the following information):

  • OS: macOS (Sonoma 14.0)
  • Browser chrome(Version 119.0.6045.123 (Official Build) (arm64))

Additional context
I am running the app on chrome and using mac M1

@littleGnAl
Copy link
Collaborator

Can you share the index.html file?

@littleGnAl littleGnAl added the waiting for customer response waiting for customer response, or closed by no-reponse bot label Nov 14, 2023
@Adrianzctpa
Copy link

Literally the same problem as mine!
Here is my index.html as OP didn't provide his:

<!DOCTYPE html>
<html>
<head>
  <!--
    If you are serving your web app in a path other than the root, change the
    href value below to reflect the base path you are serving from.

    The path provided below has to start and end with a slash "/" in order for
    it to work correctly.

    Fore more details:
    * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
  -->
  <base href="/">

  <meta charset="UTF-8">
  <meta content="IE=Edge" http-equiv="X-UA-Compatible">

  <!-- iOS meta tags & icons -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">

  <meta name="robots" content="noindex" />

  <!-- Favicon -->
  <link rel="icon" type="image/png" href="favicon.png" />

  <!-- Open Graph & SEO tags -->
  <meta property="og:description" content="Built with FlutterFlow." />
  <meta property="og:image" content="https://storage.googleapis.com/flutterflow-prod-hosting/og_splash_gradient.png" /> 

  <meta name="twitter:description" content="Built with FlutterFlow." />
  <meta name="twitter:image" content="https://storage.googleapis.com/flutterflow-prod-hosting/og_splash_gradient.png" />
  <meta name="twitter:card" content="summary_large_image" />

  <!-- Status Bar color in Safari browser (iOS) and PWA -->
  <meta name="theme-color" media="(prefers-color-scheme: light)" content="#7265e3">
  <meta name="theme-color" media="(prefers-color-scheme: dark)"  content="#1d2428">

  <link rel="manifest" href="manifest.json">
  <script>
    // The value below is injected by flutter build, do not touch.
    var serviceWorkerVersion = null;
  </script>
  <!-- This script adds the flutter initialization JS code -->
  <script src="flutter.js" defer></script>
</head>
<body>
  <script>
    
    window.addEventListener('load', function (ev) {
      // Download main.dart.js
      _flutter.loader.loadEntrypoint({
        entrypointUrl: 'main.dart.js',
        serviceWorker: {
          serviceWorkerUrl: 'flutter_service_worker.js?v=',
          serviceWorkerVersion: serviceWorkerVersion,
        },
        onEntrypointLoaded: async function(engineInitializer) {
          // Initialize the Flutter engine
          let appRunner = await engineInitializer.initializeEngine();
          // Run the app
          await appRunner.runApp();
        }
      });
    });
  </script>
  
  
  <script src="https://js.stripe.com/v3/"></script>
  <script src="iris-web-rtc_n423_w4182_0.3.0.js" type="application/javascript"></script>
  
</body>
</html>

@leilaabdel
Copy link

I am also getting the same error. This is my index.html file:

<!DOCTYPE html>
<html>
<head>
  <!--
    If you are serving your web app in a path other than the root, change the
    href value below to reflect the base path you are serving from.

    The path provided below has to start and end with a slash "/" in order for
    it to work correctly.

    For more details:
    * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base

    This is a placeholder for base href that will be replaced by the value of
    the `--base-href` argument provided to `flutter build`.
  -->
  <base href="$FLUTTER_BASE_HREF">

  <meta charset="UTF-8">
  <meta content="IE=Edge" http-equiv="X-UA-Compatible">
  <meta name="description" content="A new Flutter project.">

  <!-- iOS meta tags & icons -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="quranic_web">
  <link rel="apple-touch-icon" href="icons/Icon-192.png">

  <!-- Favicon -->
  <link rel="icon" type="image/png" href="favicon.png"/>

  <title>quranic_web</title>
  <link rel="manifest" href="manifest.json">

  <script>
    // The value below is injected by flutter build, do not touch.
    var serviceWorkerVersion = null;
  </script>
  <!-- This script adds the flutter initialization JS code -->
  <script src="flutter.js" defer></script>
</head>
<body>
  <script>
    window.addEventListener('load', function(ev) {
      // Download main.dart.js
      _flutter.loader.loadEntrypoint({
        serviceWorker: {
          serviceWorkerVersion: serviceWorkerVersion,
        },
        onEntrypointLoaded: function(engineInitializer) {
          engineInitializer.initializeEngine().then(function(appRunner) {
            appRunner.runApp();
          });
        }
      });
    });
  </script>

  <script src="https://download.agora.io/staging/iris-web-rtc_n423_w4182_0.3.0.js"></script>

</body>
</html>

The error message is as follows: Error during initialize: TypeError: Cannot read properties of undefined (reading 'initIrisRtc')

@littleGnAl
Copy link
Collaborator

Hello @Adrianzctpa @leilaabdel, I tried your html config in our example, and it works fine.
Is possible to share a reproducible demo? And can you share the flutter doctor -v?

@mdaniyal9
Copy link
Author

Hello @Adrianzctpa @leilaabdel, I tried your html config in our example, and it works fine. Is possible to share a reproducible demo? And can you share the flutter doctor -v?

Hi littleGnAl i cloned your SDK repo and gave path to package just like you have done in repo and my example started working
then i removed the Path of package from your repo and gave it the latest version 6.2.4, after that your code also gave the same error as mine was giving before.
So i think issue is in the SDK which is published with version 6.2.4
Working
agora_rtc_engine:
path: ../../CHI/Examples/Agora-Flutter-SDK

Not Working
agora_rtc_engine: ^6.2.4

@github-actions github-actions bot removed the waiting for customer response waiting for customer response, or closed by no-reponse bot label Nov 20, 2023
@littleGnAl
Copy link
Collaborator

The code has landed in the main branch but has not been published to the pub.dev yet, so 6.2.4 not included this feature yet, you should be dependent on the main branch as a git package at this time.

Add the main branch as git package:

agora_rtc_engine:
  git:
    url: https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK.git
    ref: main

Then follow the integration guide https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK?tab=readme-ov-file#web-alpha

@mdaniyal9
Copy link
Author

The code has landed in the main branch but has not been published to the pub.dev yet, so 6.2.4 not included this feature yet, you should be dependent on the main branch as a git package at this time.

Add the main branch as git package:

agora_rtc_engine:
  git:
    url: https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK.git
    ref: main

Then follow the integration guide https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK?tab=readme-ov-file#web-alpha

Now it's Working, thanks

@littleGnAl littleGnAl added the waiting for customer response waiting for customer response, or closed by no-reponse bot label Nov 20, 2023
Copy link
Contributor

github-actions bot commented Dec 4, 2023

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution.

@github-actions github-actions bot closed this as completed Dec 4, 2023
Copy link
Contributor

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please raise a new issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
waiting for customer response waiting for customer response, or closed by no-reponse bot
Projects
None yet
Development

No branches or pull requests

4 participants