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

Cannot publish package using flutter pub publish #3317

Closed
martin-braun opened this issue Feb 24, 2022 · 19 comments
Closed

Cannot publish package using flutter pub publish #3317

martin-braun opened this issue Feb 24, 2022 · 19 comments

Comments

@martin-braun
Copy link

martin-braun commented Feb 24, 2022

Environment

  • pub version or flutter pub version: Pub 2.16.1
  • OS version: MacOS 12.1 (21C52)
  • Are you using the Chinese community mirror or a corporate firewall? No
Output of `flutter doctor -v`
[✓] Flutter (Channel stable, 2.10.2, on macOS 12.1 21C52 darwin-x64, locale en-US)
    • Flutter version 2.10.2 at /usr/local/Caskroom/flutter/2.10.2/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 097d3313d8 (6 days ago), 2022-02-18 19:33:08 -0600
    • Engine revision a83ed0e5e3
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/marty/Library/Android/sdk
    • Platform android-31, build-tools 32.1.0-rc1
    • ANDROID_HOME = /Users/marty/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode-13.2.1.app/Contents/Developer
    • CocoaPods version 1.11.2

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

[✓] Android Studio (version 2021.1)
    • 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 11.0.11+0-b60-7590822)

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

[✓] Connected device (2 available)
    • Pixel 3a (mobile) • 992AY189GC • android-arm64  • Android 12 (API 31)
    • Chrome (web)      • chrome     • web-javascript • Google Chrome 98.0.4758.109

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Problem

When I try to run flutter pub publish on my package, it returns:

Connection closed before full header was received
pub finished with exit code 69

Publishing worked a month ago. I also had the issue on Flutter version 2.8.1 before trying to update.

name: google_maps_place_picker_mb
description: A Flutter plugin which provides 'Picking Place' using Google Maps
  widget. (MB version)
version: 2.0.0-mb.14
homepage: https://github.com/martin-braun/google_maps_place_picker_mb

environment:
  sdk: ">=2.12.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  geolocator: ^8.2.0
  google_api_headers: ^1.1.1
  google_maps_flutter: ^2.1.1
  google_maps_webservice: ^0.0.20-nullsafety.5
  http: ^0.13.4
  location: ^4.3.0
  provider: ^6.0.1
  tuple: ^2.0.0
  uuid: ^3.0.5

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter: null

Expected behavior

Publishing should work

Actual behavior

Output of `flutter pub publish`
Publishing google_maps_place_picker_mb 2.0.0-mb.14 to https://pub.dartlang.org:
|-- CHANGELOG.md
|-- CODE_OF_CONDUCT.md
|-- LICENSE
|-- README.md
|-- example
|   |-- README.md
|   |-- android
|   |   |-- app
|   |   |   |-- build.gradle
|   |   |   '-- src
|   |   |       |-- debug
|   |   |       |   '-- AndroidManifest.xml
|   |   |       |-- main
|   |   |       |   |-- AndroidManifest.xml.example
|   |   |       |   |-- kotlin
|   |   |       |   |   '-- com
|   |   |       |   |       '-- example
|   |   |       |   |           '-- google_map_place_picker
|   |   |       |   |               '-- example
|   |   |       |   |                   '-- MainActivity.kt
|   |   |       |   '-- res
|   |   |       |       |-- drawable
|   |   |       |       |   '-- launch_background.xml
|   |   |       |       |-- mipmap-hdpi
|   |   |       |       |   '-- ic_launcher.png
|   |   |       |       |-- mipmap-mdpi
|   |   |       |       |   '-- ic_launcher.png
|   |   |       |       |-- mipmap-xhdpi
|   |   |       |       |   '-- ic_launcher.png
|   |   |       |       |-- mipmap-xxhdpi
|   |   |       |       |   '-- ic_launcher.png
|   |   |       |       |-- mipmap-xxxhdpi
|   |   |       |       |   '-- ic_launcher.png
|   |   |       |       '-- values
|   |   |       |           '-- styles.xml
|   |   |       '-- profile
|   |   |           '-- AndroidManifest.xml
|   |   |-- build.gradle
|   |   |-- gradle
|   |   |   '-- wrapper
|   |   |       '-- gradle-wrapper.properties
|   |   |-- gradle.properties
|   |   '-- settings.gradle
|   |-- ios
|   |   |-- Flutter
|   |   |   |-- AppFrameworkInfo.plist
|   |   |   |-- Debug.xcconfig
|   |   |   '-- Release.xcconfig
|   |   |-- Podfile
|   |   |-- Podfile.lock
|   |   |-- Runner
|   |   |   |-- AppDelegate.swift
|   |   |   |-- AppDelegate.swift.example
|   |   |   |-- Assets.xcassets
|   |   |   |   |-- AppIcon.appiconset
|   |   |   |   |   |-- Contents.json
|   |   |   |   |   |-- [email protected]
|   |   |   |   |   |-- [email protected]
|   |   |   |   |   | (10 more...)
|   |   |   |   |   |-- [email protected]
|   |   |   |   |   |-- [email protected]
|   |   |   |   |   '-- [email protected]
|   |   |   |   '-- LaunchImage.imageset
|   |   |   |       |-- Contents.json
|   |   |   |       |-- LaunchImage.png
|   |   |   |       |-- [email protected]
|   |   |   |       |-- [email protected]
|   |   |   |       '-- README.md
|   |   |   |-- Base.lproj
|   |   |   |   |-- LaunchScreen.storyboard
|   |   |   |   '-- Main.storyboard
|   |   |   |-- Info.plist
|   |   |   '-- Runner-Bridging-Header.h
|   |   |-- Runner.xcodeproj
|   |   |   |-- project.pbxproj
|   |   |   |-- project.xcworkspace
|   |   |   |   '-- contents.xcworkspacedata
|   |   |   '-- xcshareddata
|   |   |       '-- xcschemes
|   |   |           '-- Runner.xcscheme
|   |   '-- Runner.xcworkspace
|   |       |-- contents.xcworkspacedata
|   |       '-- xcshareddata
|   |           '-- IDEWorkspaceChecks.plist
|   |-- lib
|   |   |-- keys.dart
|   |   |-- keys.dart.example
|   |   '-- main.dart
|   |-- pubspec.yaml
|   '-- test
|       '-- widget_test.dart
|-- lib
|   |-- google_maps_place_picker.dart
|   |-- providers
|   |   |-- place_provider.dart
|   |   '-- search_provider.dart
|   '-- src
|       |-- autocomplete_search.dart
|       |-- components
|       |   |-- animated_pin.dart
|       |   |-- floating_card.dart
|       |   |-- prediction_tile.dart
|       |   '-- rounded_frame.dart
|       |-- controllers
|       |   '-- autocomplete_search_controller.dart
|       |-- google_map_place_picker.dart
|       |-- models
|       |   |-- circle_area.dart
|       |   '-- pick_result.dart
|       '-- place_picker.dart
|-- preview.gif
|-- pubspec.yaml
|-- screenshot2.png
'-- test
    '-- google_maps_place_picker_test.dart
Connection closed before full header was received
pub finished with exit code 69
@sigurdm
Copy link
Contributor

sigurdm commented Mar 3, 2022

Does this happen consistently?

Can you try running flutter pub publish --verbose and attach the output.

@sigurdm sigurdm added the needs-info Additional information needed from the issue author label Mar 3, 2022
@martin-braun
Copy link
Author

@sigurdm It happened consistently over 2 weeks over my cellular network. I now moved to another place for holiday, thus having a new IP and it worked. I will be back in a few days and probably re-try to publish a new version and see if the problem is solved and report back with the verbose log.

Unfortunately, the verbose log is too long. How can I use stdout to file? It's log is always printed to the console, even if I pipe it.

@martin-braun
Copy link
Author

martin-braun commented Mar 6, 2022

@sigurdm I'm back in my place and the issue is back, although I'm still on the go. Here is what I could copy from the console: https://gist.github.com/martin-braun/3c3fc00908f6d6823822a1c87791b437

I then tried to connect to the hotspot from my GF (she has a different cellular network) and suddenly it works, so it has be an IP range that is causing problems? The ISP is Telekom in Germany North Rhine-Westphalia.

@jonasfj
Copy link
Member

jonasfj commented Mar 31, 2022

@martin-braun can you run it with:

export FLUTTER_ROOT=/path/to/flutter
dart pub publish --verbose

And share that as a gist.

@jonasfj
Copy link
Member

jonasfj commented Mar 31, 2022

You have no problem downloading packages, right?

@martin-braun
Copy link
Author

martin-braun commented Apr 1, 2022

@jonasfj I have no problems downloading packages. I will soon attempt update my package and report back. Thanks.

EDIT: I have to hold back for some time, because I wanted to fix an issue on one of my packages, but I cannot reproduce it and have to wait for more information by the OP. I will definitely work on the package this month, so I will definitely report back.

@jonasfj
Copy link
Member

jonasfj commented Apr 4, 2022

ping me when you do, no rush. I don't see this issue affecting many people, but that's just a guess.

@martin-braun
Copy link
Author

martin-braun commented May 16, 2022

@jonasfj I think I had the issue only once again, but no time to deal with it, so I circumvented it with a VPN. Since then I kept publishing new updates a couple of times without VPN on the same network and things worked out without problems. I have no idea at this point and choose to close this now. If this becomes a problem in the future, I will re-open it, it's really not worth to deal with, since I can fix it with a VPN and nobody else seem to have this strange problem.

Thank you for everything nontheless.

@therealmarv
Copy link

therealmarv commented Jun 8, 2022

One of our team members had always connection problems with dart pub get but only in VM/Docker environments and not on the native OS environment. It was always with exit code 69.

Your suggested workaround of using a VPN also helped in this case and it now works for her. Big thanks for the workaround @martin-braun

I'm guessing the Google's dart servers are too restrictive on some internal network or firewall settings (maybe TCP/IP number of hops?) and close the connection too fast with Connection closed before full header was received.

@wilson-christian
Copy link

@martin-braun I am facing similar issue with similar situations like you had. Earlier when I was facing this before 6 months I was able to change network and publish the package, as of today nothing is working for me.

I will try your VPN workaround if that works! but its so frustrating as there is no real solution.

@martin-braun
Copy link
Author

martin-braun commented Mar 2, 2023

@wilson-christian Could you please try to follow the instructions from @jonasfj since you can still reproduce the issue and I cannot?

can you run it with:

export FLUTTER_ROOT=/path/to/flutter
dart pub publish --verbose

And share that as a gist.

To get all the output reliably, you should actually run dart pub publish --verbose > publish.log 2>&1 though.

If you can share these details there is hope to find the root cause for it.

@IVLIVS-III
Copy link

IVLIVS-III commented May 20, 2023

I'm having the same issue, also using Telekom Germany (Baden-Württemberg area) as ISP.
Log file is attached and was created using dart pub publish --verbose > publish.log 2>&1

publish.log

Output of `flutter doctor -v`
[✓] Flutter (Channel stable, 3.10.1, on macOS 13.3.1 22E772610a darwin-x64, locale de-DE)
    • Flutter version 3.10.1 on channel stable at /Users/ivlivs/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d3d8effc68 (4 days ago), 2023-05-16 17:59:05 -0700
    • Engine revision b4fb11214d
    • Dart version 3.0.1
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/ivlivs/Library/Android/sdk
    • Platform android-33, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2022.2)
    • 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.6+0-17.0.6b802.4-9586694)

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

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 13.3.1 22E772610a darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 113.0.5672.126

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

• No issues found!

Edit: Using a VPN as a workaround did allow me to publish the package as well.

@martin-braun martin-braun reopened this May 20, 2023
@martin-braun
Copy link
Author

Thanks @IVLIVS-III, I see a pattern here, something with German ISPs maybe. Now that we have a publish.log, maybe @jonasfj can find something.

@github-actions github-actions bot removed the needs-info Additional information needed from the issue author label May 20, 2023
@IVLIVS-III
Copy link

For me the issue only appeared when publishing a package with large (> 1 MB) files. I could publish packages without such a large file without problems.

@sigurdm
Copy link
Contributor

sigurdm commented Jun 1, 2023

Thanks for the reproduction and the trace.

@jonasfj realized we are not retrying http.ClientExceptions. Probably that is what happened.

@sigurdm
Copy link
Contributor

sigurdm commented Jun 1, 2023

Closing in favour of #3938

@sigurdm sigurdm closed this as not planned Won't fix, can't repro, duplicate, stale Jun 1, 2023
@martin-braun
Copy link
Author

@sigurdm this might produce an endless loop. Back when I had these issues I couldn't fix it by retrying until switching to a different connection. I don't think simple retrying is a good approach, but maybe I miss something here(?)

@sigurdm
Copy link
Contributor

sigurdm commented Jun 6, 2023

this might produce an endless loop

We only do a limited (max 7 I think) number of retries. We already retry a number of different conditions (some subset of IOException and timeouts).
But unfortunately we missed ClientException.

Back when I had these issues I couldn't fix it by retrying

The thinking here is that we have a single open connection (cached in our package:http Client instance) that gets opened in the beginning of the publication validation, and then the connection goes stale because of aggressive connection pruning on cellular networks. When pub tries to reuse the connection it now fails, and a single retry is very likely to be all we need.

When you retry, you would go through the whole cycle, and find broken connections again.

Retrying on ClientException is a must.

That said, you are right, we cannot know for sure if this is going to help in your specific instance. Networks can fail in so many ways.

If you can still reproduce this failure on your network and a current Dart SDK, it would be a great help if you could try to clone this repository and run

$ dart path/to/pub/bin/pub.dart publish

And see if the problem still occurs.

Thanks!

@martin-braun
Copy link
Author

@sigurdm Thanks for clarifying with these descriptions. I don't have this problem anymore, but when I do, I (and hopefully others) will give it a shot. For now, I assume this solves all our problems regarding this issue.

Thanks for your service! :)

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

6 participants