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

[Bug]: ClientException: Invalid content-length header [-1] when reading version.json on a Firefox extension #3028

Closed
8 tasks done
Chralu opened this issue Jun 20, 2024 · 4 comments
Labels
bug Something isn't working package_info_plus stuff related to package_info_plus Stale triage web

Comments

@Chralu
Copy link

Chralu commented Jun 20, 2024

Platform

Firefox extension

Plugin

package_info_plus

Version

8.0.0

Flutter SDK

3.19.6

Steps to reproduce

On a Flutter application built as a Firefox extension, run the following code

await PackageInfo.fromPlatform();

An exception is thrown.

This is related to dart-lang/http#1240
Using Dio to perform the request works.

I'm not sure if package_info_plus should be changed to use Dio while http (or Firefox) is not fixed...
This bug report is mainly here to keep track of the issue.

Code Sample

No response

Logs

Uncaught : ClientException: Invalid content-length header [-1]., uri=moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/version.json? main.dart.js:9957:43
    wrapException moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:9957
    Error__throw moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:16148
    Error_throwWithStackTrace moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:16426
    call$0 moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:129440
    _microtaskLoop moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:13331
    _startMicrotaskLoop moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:13337
    call$1 moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:126348
    (Asynchrone : MutationCallback)
    _AsyncRun__initializeScheduleImmediate moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:12869
    <anonyme> moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:401067
    getterName moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:143
    _scheduleAsyncCallback moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:13351
    _rootScheduleMicrotask moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:13624
    scheduleMicrotask moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:13380
    initialize$0 moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:107204
    0 moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:109100
    $protected moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:12942
    call$2 moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:126475
    _asyncStartSync moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:12906
    call$0 moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:109109
    initializeEngineServices moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:3829
    $protected moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:12942
    call$2 moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:126475
    _asyncStartSync moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:12906
    initializeEngineServices$body moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:3838
    initializeEngineServices moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:3792
    1 moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:143750
    $protected moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:12942
    call$2 moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:126475
    _asyncStartSync moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:12906
    $call$body$bootstrapEngine_closure moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:143757
    call$1 moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:143729
    call$0 moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:143732
    0 moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:100034
    $protected moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:12942
    call$2 moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:126475
    _asyncStartSync moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:12906
    autoStart$0 moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:100046
    bootstrapEngine moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:20798
    $protected moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:12942
    call$2 moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:126475
    _asyncStartSync moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:12906
    bootstrapEngine moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:20814
    main moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:94027
    $protected moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:12942
    call$2 moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:126475
    _asyncStartSync moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:12906
    main moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:94034
    <anonyme> moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:402776
    <anonyme> moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:402757
    dartProgram moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:402770
    <anonyme> moz-extension://b48b7e2c-4e5b-4d98-8fc5-9bdcde0f06b5/main.dart.js:402779

Flutter Doctor

[✓] Flutter (Channel stable, 3.19.6, on macOS 14.5 23F79 darwin-arm64, locale fr-FR)
    • Flutter version 3.19.6 on channel stable at /Users/charly/.asdf/installs/flutter/3.19.6-stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (9 weeks ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/charly/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/charly/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] VS Code (version 1.90.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.90.0

[✓] Connected device (3 available)
    • iPhone (mobile) • c306a3b848f6edcef962732c2692daa2df05a9f5 • ios            • iOS 16.7.8 20H343
    • macOS (desktop) • macos                                    • darwin-arm64   • macOS 14.5 23F79 darwin-arm64
    • Chrome (web)    • chrome                                   • web-javascript • Google Chrome 126.0.6478.62

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Checklist before submitting a bug

  • I searched issues in this repository and couldn't find such bug/problem
  • I Google'd a solution and I couldn't find it
  • I searched on StackOverflow for a solution and I couldn't find it
  • I read the README.md file of the plugin
  • I'm using the latest version of the plugin
  • All dependencies are up to date with flutter pub upgrade
  • I did a flutter clean
  • I tried running the example project
@Chralu Chralu added bug Something isn't working triage labels Jun 20, 2024
@miquelbeltran miquelbeltran added package_info_plus stuff related to package_info_plus web labels Jun 27, 2024
@miquelbeltran miquelbeltran changed the title [Bug]: [Bug]: ClientException: Invalid content-length header [-1] when reading version.json on Firefox Jun 27, 2024
@miquelbeltran miquelbeltran changed the title [Bug]: ClientException: Invalid content-length header [-1] when reading version.json on Firefox [Bug]: ClientException: Invalid content-length header [-1] when reading version.json on a Firefox extension Jun 27, 2024
@miquelbeltran
Copy link
Member

Any chance you can provide a link to a sample project showcasing this error?

@Chralu
Copy link
Author

Chralu commented Jul 8, 2024

Hi @miquelbeltran ,

here is a demo project.

Running it,using package_info_plus: 8.0.0 you will get a Failure : Bad state: Origin is only applicable to schemes http and https: moz-extension://40ae7a4c-2b83-4e0d-bf15-b69c263daa35/index.html exception.

In the demo project, I use my fork's PR which adds a quick fix to that behavior.
Using that fork, you will get the ClientException.

@miquelbeltran
Copy link
Member

Thanks! I honestly have no clue how to solve this, but maybe others can contribute.

Your PR change looks good and can be merged once the description and subject is good.

Copy link

github-actions bot commented Oct 7, 2024

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days

@github-actions github-actions bot added the Stale label Oct 7, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working package_info_plus stuff related to package_info_plus Stale triage web
Projects
None yet
Development

No branches or pull requests

2 participants