8000 MIME Type Issues Even With Brotli/Disabled Compression Formatting · Issue #970 · juicycleff/flutter-unity-view-widget · GitHub
[go: up one dir, main page]

Skip to content
MIME Type Issues Even With Brotli/Disabled Compression Formatting #970
Open
@nsdod

Description

@nsdod

Hi! I'm seeing an issue where the Unity Flutter widget doesn't load properly when navigated to from another page (WebGL). The error log appears as follows:

errors.dart:296 Uncaught (in promise) Error
    at Object.throw_ [as throw] (errors.dart:296:3)
    at Object.assertFailed (errors.dart:29:3)
    at get page (page_view.dart:170:17)
    at page_view.PageController.new.nextPage (page_view.dart:223:26)
    at onboarding_widget._OnboardingWidgetState.new.<anonymous> (onboarding_widget.dart:41:40)
    at Generator.next (<anonymous>)
    at async_patch.dart:45:50
    at _RootZone.runUnary (zone.dart:1661:54)
    at _FutureListener.thenAwait.handleValue (future_impl.dart:163:18)
    at handleValueCallback (future_impl.dart:847:44)
    at _Future._propagateToListeners (future_impl.dart:876:13)
    at [_complete] (future_impl.dart:643:7)
    at future.dart:420:15
    at internalCallback (isolate_helper.dart:48:11)
[...]

js_primitives.dart:28 Created Unity scene: attach controller
flutter.js:3 Exception while loading service worker: DOMException: Failed to register a ServiceWorker for scope ('http://localhost:55405/modEdit/UnityLibrary/') with script ('http://localhost:55405/modEdit/UnityLibrary/flutter_service_worker.js?v='): The script has an unsupported MIME type ('text/html').
(anonymous) @ flutter.js:3
Promise.catch (async)
loadEntrypoint @ flutter.js:3
(anonymous) @ index.html:66
load (async)
(anonymous) @ index.html:64

index.html:1 Refused to execute script from 'http://localhost:55405/modEdit/UnityLibrary/main.dart.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
2errors.dart:296 Uncaught Error
    at Object.throw_ [as throw] (errors.dart:296:3)
    at Object._failedAsCheck (rti.dart:1388:3)
    at dart_rti.Rti.new._generalAsCheckImplementation (rti.dart:1366:3)
    at Object._argumentErrors (operations.dart:243:33)
    at Object._checkAndCall (operations.dart:422:22)
    at Object.callMethod (operations.dart:494:10)
    at Object.dsend (operations.dart:498:5)
    at web_unity_widget_controller.dart:114:27

The error references a MIME type issue that, from previous reports, appear to usually be caused by selecting the GZIP compression format. However, this Unity project is built to WEBGL with the compression formatting disabled (and changing it to Brotli doesn't fix the issue). The UnityLibrary assets appear to be in the correct place after exporting.

The 'modEdit' reference as seen in this error is the previous page from which the Unity widget's page is navigated to. Could this have something to do with how the iframe used to contain the Unity application loads into the widget, or a strange interaction with the Navigation stack? The base application is made with Flutterflow. However, the Unity Flutter widget is added to the project manually, after exporting the project to into Dart/Flutter code. Lottie animations are in use for page transitions.

Browser: Google Chrome 126.0.6478.127
Unity version: 2022.3.27f1
Flutter: 3.22.2
Dart: 3.4.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    WebGLThis issue is specific to the Web platform

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0