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

Error starting app on chrome #47

Open
ghost opened this issue May 28, 2023 · 9 comments
Open

Error starting app on chrome #47

ghost opened this issue May 28, 2023 · 9 comments

Comments

@ghost
Copy link

ghost commented May 28, 2023

libphonenumber.min.js:7 Uncaught TypeError: Cannot set properties of null (setting 'exports')
    at libphonenumber.min.js:7:87
    at libphonenumber.min.js:7:330
(anonymous) @ libphonenumber.min.js:7
(anonymous) @ libphonenumber.min.js:7
flutter_libphonenumber_web.dart:73 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'PhoneNumberUtil')
    at getAllSupportedRegions (flutter_libphonenumber_web.dart:73:44)
    at getAllSupportedRegions.next (<anonymous>)
    at async_patch.dart:45:50
    at _RootZone.runUnary (zone.dart:1661:54)
    at _FutureListener.thenAwait.handleValue (future_impl.dart:147:18)
    at handleValueCallback (future_impl.dart:784:44)
    at _Future._propagateToListeners (future_impl.dart:813:13)
    at async._AsyncCallbackEntry.new.callback (future_impl.dart:448:9)
    at Object._microtaskLoop (schedule_microtask.dart:40:11)
    at _startMicrotaskLoop (schedule_microtask.dart:49:5)
    at async_patch.dart:177:15
Screenshot 2023-05-29 at 2 22 06 AM
@ghost
Copy link

ghost commented May 31, 2023

Nice catch. I can reproduce it on the latest flutter 3.10, but it works fine in 3.7. It must be an issue in flutter that changed in the meantime.

@ghost
Copy link

ghost commented May 31, 2023

It seems to be an error only in debug builds: flutter/flutter#126713

@ghost
Copy link

ghost commented May 31, 2023

I would say let's keep this open and track that issue above for a fix to land in flutter. There are some workarounds mentioned here: https://stackoverflow.com/questions/55113108/is-it-possible-to-lazily-use-js-libs-with-dart/55192098#55192098 and in the linked issue above.

@ramachandran-muthiah
Copy link

Our web release have been blocked due to this issue, is there any update or workaround exists? Some of the workaround suggested doesn't solve the issue, in Release mode "flutter_libphonenumber" the code is pulled from CDN - https://cdn.jsdelivr.net/gh/ruimarinho/google-libphonenumber@b7fe84af9b553f0f2db765a6e20c27fa867a971d/dist/libphonenumber.min.js

Error details -

Uncaught TypeError: Cannot set properties of null (setting 'exports')
at libphonenumber.min.js:7:87
at libphonenumber.min.js:7:330

@acoutts
Copy link
Owner

acoutts commented Jul 19, 2023

@ramachandran-muthiah looking at the above issue, they also mention this is a related one: flutter/flutter#126131

That says the fix has landed in flutter ~3 weeks ago. Does it still happen on the master channel now?

@SFocus
Copy link

SFocus commented Aug 10, 2023

TypeError: Cannot set properties of null (setting 'exports')
https://cdn.jsdelivr.net/gh/ruimarinho/google-libphonenumber@b7fe84af9b553f0f2db765a6e20c27fa867a971d/dist/libphonenumber.min.js 7:87   <fn>
https://cdn.jsdelivr.net/gh/ruimarinho/google-libphonenumber@b7fe84af9b553f0f2db765a6e20c27fa867a971d/dist/libphonenumber.min.js 7:330  <fn>
TypeError: Cannot read properties of undefined (reading 'PhoneNumberUtil')
packages/flutter_libphonenumber_web/flutter_libphonenumber_web.dart 73:44  getAllSupportedRegions
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50   

I got this error too in the latest version. Tried on Chrome.

@jpflick-stx
Copy link

jpflick-stx commented Aug 14, 2023

TypeError: Cannot set properties of null (setting 'exports')
Attempting to run flutter_libphonenumber 2.1.5 package example, and getting above error in Flutter 3.10.6. Runs on Android device, but not Chrome or Edge.

Tried the following to no avail:
`Future main() async {
WidgetsFlutterBinding.ensureInitialized();
setPathUrlStrategy();

context.callMethod('fixRequireJs');
await init();
...
<script type="text/javascript">
window.fixRequireJs = function()
{
console.log('define is ', typeof define);
if (typeof define == 'function') {
console.log('removing define...');
delete define;
window.define = null;
}
}
</script>`

@fabienbranchel
Copy link

@ramachandran-muthiah looking at the above issue, they also mention this is a related one: flutter/flutter#126131

That says the fix has landed in flutter ~3 weeks ago. Does it still happen on the master channel now?

Fix with Flutter 3.13.0, thanks !

@acoutts
Copy link
Owner

acoutts commented Dec 7, 2023

Is it safe to close this now?

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