mixpanel-flutter icon indicating copy to clipboard operation
mixpanel-flutter copied to clipboard

Uncaught MissingPluginException after deploying web version

Open tejHackerDEV opened this issue 2 years ago • 11 comments

Hi guys, I was using mixpanel in flutter web. When I am testing it in local, it is working fine but when I deployed it on firebase hosting, it started throwing error on Mixpanel.init() with the error "Uncaught MissingPluginException(No implementation found for method initialize on channel mixpanel_flutter)" & causing the app not be load. So please check this as it is blocking our release.

tejHackerDEV avatar Oct 04 '22 13:10 tejHackerDEV

Check your code in index.html

<head>
    // ~~~
    <script src="flutter.js" defer></script>
    <script src="./assets/packages/mixpanel_flutter/assets/mixpanel.js"></script>
</head>

It should be written END LINE OF HEAD.

LOCKEDFILE avatar Dec 26 '22 08:12 LOCKEDFILE

I am having the same issue. My script tag is in the correct place in index.html

the package is working fine locally (in debug)

But when I deploy using firebase hosting it is throwing this error: Uncaught MissingPluginException(No implementation found for method initialize on channel mixpanel_flutter)

DamDam98 avatar Jan 17 '23 04:01 DamDam98

I am having this same problem in Flutter 3.10.2 with version 2.1.1.

In local environment it works correctly, but when deploying on Google App Engine the same error occurs: Uncaught MissingPluginException(No implementation found for method initialize on channel mixpanel_flutter)

pubspec.yaml: mixpanel_flutter: ^2.1.1 # https://pub.dev/packages/mixpanel_flutter

index.html (at the end):

<head>
   ...
  <script src="./assets/packages/mixpanel_flutter/assets/mixpanel.js"></script>
</head>

jemutorres avatar Jun 16 '23 08:06 jemutorres

For me the error was: PlatformException: Cannot read properties of undefined (reading 'init'), null, null). Adding this to index.html fix the issue for both release and debug builds:

<head>
   ...
  <script src="./assets/packages/mixpanel_flutter/assets/mixpanel.js"></script>
</head>

jomonson avatar Jun 17 '23 19:06 jomonson

PlatformException: Cannot read properties of undefined (reading 'init'), null, null) is caused by a missing script tag, but MissingPluginException(No implementation found for method initialize on channel mixpanel_flutter) occurs even with the tag in place.

https://github.com/mixpanel/mixpanel-flutter/issues/91 suggests that the error occurs due to ad blockers, but I have the same issue even if all ad blockers are disabled and all calls to the mixpanel CDN returns 200. Both in chrome and firefox.

Hannnes1 avatar Jul 05 '23 13:07 Hannnes1

Any updates on this issue as I am currently facing the similar issue after deployed to Firebase Hosting.

devr-tech avatar Oct 13 '23 06:10 devr-tech

Still having the issue in production, also on firebase hosting.

I did add

btribouillet avatar Jan 11 '24 13:01 btribouillet

Still facing this issue. Is there any plan to fix it as it has been in "Open" state for long.

@tejHackerDEV What did you use to get rid of this issue? Did you use some other package?

arpit24sahu avatar Mar 12 '24 11:03 arpit24sahu

What worked for me!!

flutter clean
flutter pub get

and then build

Abdullah-Uppal avatar Apr 23 '24 06:04 Abdullah-Uppal