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

Internal Error MapStyler #55039

Closed
JgomesAT opened this issue Feb 28, 2024 · 9 comments
Closed

Internal Error MapStyler #55039

JgomesAT opened this issue Feb 28, 2024 · 9 comments
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-js-interop Issues that impact all js interop

Comments

@JgomesAT
Copy link

I have this erroe in build flutter web of google maps web Dart 3.3.0

google_maps_flutter_web-0.5.5/lib/src/map_styler.dart:15:20:
Internal Error: Unknown external method j:method(MapStyler|constructor#)
external factory MapStyler({

The compiler crashed: Assertion failure: Unknown external method j:method(MapStyler|constructor#)
#0 failedAt (package:compiler/src/diagnostics/invariant.dart:39:3)
#1 KernelSsaGraphBuilder._buildExternalFunctionNode (package:compiler/src/ssa/builder.dart:1825:5)
#2 KernelSsaGraphBuilder.build. (package:compiler/src/ssa/builder.dart:439:15)
#3 DiagnosticReporter.withCurrentElement (package:compiler/src/diagnostics/diagnostic_listener.dart:154:15)
#4 KernelSsaGraphBuilder.build (package:compiler/src/ssa/builder.dart:427:21)
#5 KernelSsaBuilder.build. (package:compiler/src/js_model/js_strategy.dart:525:22)
#6 CompilerTask.measure (package:compiler/src/common/tasks.dart:66:51)
#7 KernelSsaBuilder.build (package:compiler/src/js_model/js_strategy.dart:507:18)
#8 SsaBuilderTask.build (package:compiler/src/ssa/ssa.dart:365:21)
#9 SsaFunctionCompiler.compile (package:compiler/src/ssa/ssa.dart:99:28)
#10 OnDemandCodegenResults.getCodegenResults (package:compiler/src/common/codegen.dart:409:30)
#11 JsBackendStrategy.generateCode (package:compiler/src/js_model/js_strategy.dart:331:43)
#12 KernelCodegenWorkItem.run (package:compiler/src/js_model/js_strategy.dart:466:29)
#13 Compiler.emptyQueue.....
(package:compiler/src/compiler.dart:752:70)
#14 CompilerTask.measureSubtask (package:compiler/src/common/tasks.dart:181:35)
#15 Compiler.emptyQueue....
(package:compiler/src/compiler.dart:752:32)
#16 CompilerTask.measureSubtask (package:compiler/src/common/tasks.dart:181:35)
#17 Compiler.emptyQueue... (package:compiler/src/compiler.dart:750:28)
#18 DiagnosticReporter.withCurrentElement (package:compiler/src/diagnostics/diagnostic_listener.dart:154:15)
#19 Compiler.emptyQueue.. (package:compiler/src/compiler.dart:748:18)
#20 CodegenEnqueuer._forEach (package:compiler/src/js_backend/enqueuer.dart:266:12)
#21 CodegenEnqueuer.forEach (package:compiler/src/js_backend/enqueuer.dart:282:5)
#22 Compiler.emptyQueue. (package:compiler/src/compiler.dart:744:16)
#23 CompilerTask.measureSubtask (package:compiler/src/common/tasks.dart:181:35)
#24 Compiler.emptyQueue (package:compiler/src/compiler.dart:743:14)
#25 Compiler.processQueue. (package:compiler/src/compiler.dart:767:7)
#26 CompilerTask.measureSubtask (package:compiler/src/common/tasks.dart:181:35)
#27 Compiler.processQueue (package:compiler/src/compiler.dart:761:14)
#28 Compiler.runCodegenEnqueuer (package:compiler/src/compiler.dart:472:5)
#29 Compiler.runSequentialPhases (package:compiler/src/compiler.dart:680:27)

#30 Compiler.runInternal. (package:compiler/src/compiler.dart:315:7)

#31 Compiler.runInternal (package:compiler/src/compiler.dart:314:5)

#32 Compiler.run. (package:compiler/src/compiler.dart:235:11)

#33 compile. (package:compiler/compiler_api.dart:256:30)

#34 compile.compilationDone (package:compiler/src/dart2js.dart:729:3)

#35 main (package:compiler/src/dart2js.dart:1233:3)

Command: /Users/jorgegomes/Development/Flutter2_SDK/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev
/Users/jorgegomes/Development/Flutter2_SDK/flutter/bin/cache/dart-sdk/bin/snapshots/dart2js.dart.snapshot
--platform-binaries=/Users/jorgegomes/Development/Flutter2_SDK/flutter/bin/cache/flutter_web_sdk/kernel --invoker=flutter_tool
-Ddart.vm.product=true -Denvironment=3 -DFLUTTER_WEB_AUTO_DETECT=false -DFLUTTER_WEB_USE_SKIA=true
-DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/04817c99c9fd4956f27505204f7e344335810aed/ --native-null-assertions
--no-source-maps -O4 -o
/Users/jorgegomes/git/at-app/at-customer-portal-web/customer-portal/.dart_tool/flutter_build/0c076123d08b2ecfd3753bbc57bdddda/main.dart.js
/Users/jorgegomes/git/at-app/at-customer-portal-web/customer-portal/.dart_tool/flutter_build/0c076123d08b2ecfd3753bbc57bdddda/app.dill

@parlough parlough added the area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. label Feb 28, 2024
@parlough
Copy link
Member

\cc @srujzs @ditman seems to be after flutter/packages#5254

@navaronbracke
Copy link

navaronbracke commented Feb 28, 2024

That is indeed where we introduced the MapStyler, to remove a usage of jsify().

According to the GoogleMaps docs, the stylers attribute accepts a list of object literals.
However, the extension type provides an external factory constructor with named arguments, which should try to create object literals? (we did annotate it with @anonymous as well) So I don't get why we are trying to invoke a class constructor in JS?

I'll have a look to see if I can reproduce.

@navaronbracke
Copy link

navaronbracke commented Feb 28, 2024

I cannot seem to reproduce this crash on Flutter 3.19.1 / Dart 3.3.0 with google_maps_flutter_web 0.5.5, using the google_maps_flutter example app.

The night mode toggle (which creates a MapStyler by calling setMapStyle()) works without issues (the map does change into darker colors), and inspecting the MapStyler() JS interop objects before they are sent to GoogleMaps, indicates they are created correctly.

@JgomesAT
Copy link
Author

JgomesAT commented Feb 28, 2024

I think the problem is the combination with those overrides:

Is required to be able to build the app using Flutter 3.19. Can be removed

when firebase_core uses web >= 0.5.1.

web:
git:
url: https://github.com/dart-lang/web/
ref: d96c01d2252372c9e0fa7ffa52d2d1df331c248b

@biggs0125 biggs0125 added the web-js-interop Issues that impact all js interop label Feb 28, 2024
@srujzs
Copy link
Contributor

srujzs commented Feb 28, 2024

I believe this is from #54801, which is fixed in the latest dev release, but not in 3.3. It seems weird that we couldn't repro in 3.3.

@navaronbracke
Copy link

navaronbracke commented Feb 28, 2024

@srujzs Thanks for the help. I'll prepare a follow-up PR with the changes to the annotations sometime tomorrow. (unless someone else wants to do it:) )

I only tested with DDC and not dart2js on 3.3 though (although, do the integration tests run in release mode?)

As you said

DDC doesn't come across this issue because it assumes all external, extension type members with named parameters are object literal constructors.

would explain why I didn't see it (but the integration tests should have?)

@srujzs
Copy link
Contributor

srujzs commented Feb 28, 2024

flutter/packages#6216

Ah, it being DDC would definitely make a difference. Since Flutter 3.19 is tightly bound to Dart 3.3, if the integration tests ran with dart2js, it should have been caught on compile, so I'm not sure either!

auto-submit bot pushed a commit to flutter/packages that referenced this issue Feb 28, 2024
These are needed for 3.3 in order to address issue dart-lang/sdk#54801. This commit also cleans up some unnecessary annotations.

Also publishes 0.5.7.

dart-lang/sdk#55039
@srujzs
Copy link
Contributor

srujzs commented Feb 28, 2024

Marking this as closed now that the above PR has landed. Let me know if any issues persist.

@srujzs srujzs closed this as completed Feb 28, 2024
@ditman
Copy link
Member

ditman commented Feb 28, 2024

Thanks for getting this fixed, I ran the tests locally but didn't see the issue either! (I probably only tested in debug/ddc mode, of course)

LouiseHsu pushed a commit to LouiseHsu/packages that referenced this issue Mar 7, 2024
These are needed for 3.3 in order to address issue dart-lang/sdk#54801. This commit also cleans up some unnecessary annotations.

Also publishes 0.5.7.

dart-lang/sdk#55039
arc-yong pushed a commit to Arctuition/packages-arc that referenced this issue Jun 14, 2024
These are needed for 3.3 in order to address issue dart-lang/sdk#54801. This commit also cleans up some unnecessary annotations.

Also publishes 0.5.7.

dart-lang/sdk#55039
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-js-interop Issues that impact all js interop
Projects
None yet
Development

No branches or pull requests

6 participants