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

web: Running into NoSuchMethodError under build mode release #107

Open
markusrubey opened this issue Apr 19, 2023 · 4 comments
Open

web: Running into NoSuchMethodError under build mode release #107

markusrubey opened this issue Apr 19, 2023 · 4 comments

Comments

@markusrubey
Copy link

markusrubey commented Apr 19, 2023

caught PlatformException(error, NoSuchMethodError: method not found: 'identify' (mixpanel.identify is not a function), null, null)
    at Object.f (http://localhost:8080/main.dart.js:5183:3)
    at agI.aj1 (http://localhost:8080/main.dart.js:86999:14)
    at http://localhost:8080/main.dart.js:87091:98
    at bq8.a (http://localhost:8080/main.dart.js:6454:62)
    at bq8.$2 (http://localhost:8080/main.dart.js:56414:14)
    at boF.$1 (http://localhost:8080/main.dart.js:56408:21)
    at asd.a5s (http://localhost:8080/main.dart.js:57087:34)
    at b9h.$0 (http://localhost:8080/main.dart.js:56699:11)
    at Object.KC (http://localhost:8080/main.dart.js:6564:40)
    at aV.yf (http://localhost:8080/main.dart.js:56631:3)
core_patch.dart:241 Uncaught PlatformException(error, NoSuchMethodError: method not found: 'set' on null, null, null)
    at Object.f (http://localhost:8080/main.dart.js:5183:3)
    at agI.aj1 (http://localhost:8080/main.dart.js:86999:14)
    at http://localhost:8080/main.dart.js:87091:98
    at bq8.a (http://localhost:8080/main.dart.js:6454:62)
    at bq8.$2 (http://localhost:8080/main.dart.js:56414:14)
    at boF.$1 (http://localhost:8080/main.dart.js:56408:21)
    at asd.a5s (http://localhost:8080/main.dart.js:57087:34)
    at b9h.$0 (http://localhost:8080/main.dart.js:56699:11)
    at Object.KC (http://localhost:8080/main.dart.js:6564:40)
    at aV.yf (http://localhost:8080/main.dart.js:56631:3)
2core_patch.dart:241 Uncaught PlatformException(error, NoSuchMethodError: method not found: 'register' (mixpanel.register is not a function), null, null)
    at Object.f (http://localhost:8080/main.dart.js:5183:3)
    at agI.aj1 (http://localhost:8080/main.dart.js:86999:14)
    at http://localhost:8080/main.dart.js:87091:98
    at bq8.a (http://localhost:8080/main.dart.js:6454:62)
    at bq8.$2 (http://localhost:8080/main.dart.js:56414:14)
    at boF.$1 (http://localhost:8080/main.dart.js:56408:21)
    at asd.a5s (http://localhost:8080/main.dart.js:57087:34)
    at b9h.$0 (http://localhost:8080/main.dart.js:56699:11)
    at Object.KC (http://localhost:8080/main.dart.js:6564:40)
    at aV.yf (http://localhost:8080/main.dart.js:56631:3)

I followed the set up instructions from pub dev and also checked your example here. I have no issues under debug. My call to Mixpanel.init throws no error.

I noticed I am missing some functionality in my main.dart.js when comparing:

Mixpanel Example main.dart.js
  A.Mixpanel.prototype = {
    hasOptedOutTracking$0() {
      var $async$goto = 0,
        $async$completer = A._makeAsyncAwaitCompleter(type$.nullable_bool),
        $async$returnValue;
      var $async$hasOptedOutTracking$0 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
        if ($async$errorCode === 1)
          return A._asyncRethrow($async$result, $async$completer);
        while (true)
          switch ($async$goto) {
            case 0:
              // Function start
              $async$goto = 3;
              return A._asyncAwait(B.MethodChannel_0nx._invokeMethod$1$3$arguments$missingOk("hasOptedOutTracking", null, false, type$.bool), $async$hasOptedOutTracking$0);
            case 3:
              // returning from await.
              $async$returnValue = $async$result;
              // goto return
              $async$goto = 1;
              break;
            case 1:
              // return
              return A._asyncReturn($async$returnValue, $async$completer);
          }
      });
      return A._asyncStartSync($async$hasOptedOutTracking$0, $async$completer);
    },
    identify$1(distinctId) {
      if (distinctId.length !== 0)
        B.MethodChannel_0nx._invokeMethod$1$3$arguments$missingOk("identify", A.LinkedHashMap_LinkedHashMap$_literal(["distinctId", distinctId], type$.String, type$.dynamic), false, type$.void);
      else
        A.log0("`identify` failed: distinctId cannot be blank", "Mixpanel");
    },
    alias$2(alias, distinctId) {
      if (alias.length === 0) {
        A.log0("`alias` failed: alias cannot be blank", "mixpanel");
        return;
      }
      if (distinctId.length === 0) {
        A.log0("`alias` failed: distinctId cannot be blank", "Mixpanel");
        return;
      }
      B.MethodChannel_0nx._invokeMethod$1$3$arguments$missingOk("alias", A.LinkedHashMap_LinkedHashMap$_literal(["alias", alias, "distinctId", distinctId], type$.String, type$.dynamic), false, type$.void);
    },
    track$2$properties(_, eventName, properties) {
      if (eventName.length !== 0)
        B.MethodChannel_0nx._invokeMethod$1$3$arguments$missingOk("track", A.LinkedHashMap_LinkedHashMap$_literal(["eventName", eventName, "properties", properties], type$.String, type$.dynamic), false, type$.void);
      else
        A.log0("`track` failed: eventName cannot be blank", "Mixpanel");
    },
    track$1($receiver, eventName) {
      return this.track$2$properties($receiver, eventName, null);
    },
    getSuperProperties$0() {
      var $async$goto = 0,
        $async$completer = A._makeAsyncAwaitCompleter(type$.nullable_Map_dynamic_dynamic),
        $async$returnValue;
      var $async$getSuperProperties$0 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
        if ($async$errorCode === 1)
          return A._asyncRethrow($async$result, $async$completer);
        while (true)
          switch ($async$goto) {
            case 0:
              // Function start
              $async$goto = 3;
              return A._asyncAwait(B.MethodChannel_0nx._invokeMethod$1$3$arguments$missingOk("getSuperProperties", null, false, type$.Map_dynamic_dynamic), $async$getSuperProperties$0);
            case 3:
              // returning from await.
              $async$returnValue = $async$result;
              // goto return
              $async$goto = 1;
              break;
            case 1:
              // return
              return A._asyncReturn($async$returnValue, $async$completer);
          }
      });
      return A._asyncStartSync($async$getSuperProperties$0, $async$completer);
    },
    getDistinctId$0() {
      var t1 = type$.String;
      return B.MethodChannel_0nx._invokeMethod$1$3$arguments$missingOk("getDistinctId", null, false, t1).then$1$1(new A.Mixpanel_getDistinctId_closure(), t1);
    },
    flush$0(_) {
      var $async$goto = 0,
        $async$completer = A._makeAsyncAwaitCompleter(type$.void);
      var $async$flush$0 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) {
        if ($async$errorCode === 1)
          return A._asyncRethrow($async$result, $async$completer);
        while (true)
          switch ($async$goto) {
            case 0:
              // Function start
              $async$goto = 2;
              return A._asyncAwait(B.MethodChannel_0nx._invokeMethod$1$3$arguments$missingOk("flush", null, false, type$.dynamic), $async$flush$0);
            case 2:
              // returning from await.
              // implicit return
              return A._asyncReturn(null, $async$completer);
          }
      });
      return A._asyncStartSync($async$flush$0, $async$completer);
    }
  };
My Project main.dart.js
  A.Mixpanel.prototype = {
    track$2$properties(_, eventName, properties) {
      if (eventName.length !== 0)
        B.MethodChannel_0nx._invokeMethod$1$3$arguments$missingOk("track", A.LinkedHashMap_LinkedHashMap$_literal(["eventName", eventName, "properties", properties], type$.String, type$.dynamic), false, type$.void);
    }
  };
  
@bselwe
Copy link

bselwe commented Nov 8, 2023

I am also running into the same issue in production. Did you find any solution to that @markusrubey?

minified:jI: PlatformException(error, NoSuchMethodError: method not found: 'track' (mixpanel.track is not a function. (In 'mixpanel.track(o,A.ae(r))', 'mixpanel.track' is undefined)), null, null)

cc @zihejia

@DavidRG13
Copy link

Hi @bselwe, @zihejia and @markusrubey
I am facing this issue while running version 2.2.0 of the library locally in Chrome. Have you found a solution or workaround?
Thank you!

@adar2378
Copy link

adar2378 commented Apr 8, 2024

Anyone found any fixes? Is this resolved in latest 2.3.0 version?

@yelkamel
Copy link

yelkamel commented May 7, 2024

I have the same issue only on release mode for web.

And I'm block to the version 2.2.0 of mixpanel because to upgrade to 2.3.0

I need to change to much package in my app ...

  • js ^0.7.1
  • statsig ^1.0.0
  • flame_audio ^2.10.1
  • crisp_sdk: ^1.1.0

for the moment, I turned of mixpanel on web on my project :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants