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

gitlab-CI: WebSocketException: Connection to 'http://127.0.0.1:33655#' was not upgraded to websocket #158

Closed
boldt opened this issue May 25, 2021 · 6 comments

Comments

@boldt
Copy link
Contributor

boldt commented May 25, 2021

Hint: I cross-posted this issue also on flutter/flutter#83344, since I don't know whether it's a flutter issue or an issue with the docker-image.

Environment

  • Flutter 2.2.0
  • Gitlab CI

Steps to Reproduce

I created the standard "getting started" app:

flutter create flutter_test_mwe

On our local machines, we can run flutter test, which succeeds:

grafik

Now, we want to build the app with gitlab-CI. We're using the image cirrusci/flutter:2.2.0:

variables:
  FLUTTER_VERSION: 2.2.0

stages:
  - build
  - deploy

build_and_test_job:
  stage: build
  image: cirrusci/flutter:$FLUTTER_VERSION
  script:
    - flutter pub get
    - flutter test
    - flutter build apk
  tags:
    - docker
  only:
    - merge_requests

Now, flutter testcrashes with the error:

WebSocketException: Connection to 'http://127.0.0.1:33655#' was not upgraded to websocket

grafik

@fkorotkov
Copy link
Contributor

Looks more like an issue with your GitLab setup. Will be great if it can be reproduced locally in a docker container. Will be great if you can try 0.0.0.0 and localhost instead of 127.0.0.1.

@boldt
Copy link
Contributor Author

boldt commented May 25, 2021

I would like to help you to reproduce this issue.

To do so...

  • I would like to unserstand, why "flutter test" tries to open a WebSocket-connection, and
  • How do I configre "flutter test" use another IP?

@fkorotkov
Copy link
Contributor

We can try to repro locally in a Docker container by using Cirrus CLI. Once you install it you can create .cirrus.yml in your repo with the following content:

env:
  FLUTTER_VERSION: 2.2.0

test_task:
  container:
    image: cirrusci/flutter:$FLUTTER_VERSION
  script:
    - flutter pub get
    - flutter test
    - flutter build apk

Once you have it you can try to run cirrus run and see if it's working. If it is, it means your host has some issue with Docker configuration and networking. You are using a self-hosted runner, right?

@fkorotkov
Copy link
Contributor

Closing because of inactivity and not enough information to reproduce 😪

@boldt
Copy link
Contributor Author

boldt commented Jun 25, 2021

We solved it.

Our gitlab-runner runs behind a corporate proxy server, thus PROXY variables were mapped into the runner.
Unfortunately, we forgot to add localhost to the NO_PROXY variable, thus the runner tried to resolve localhost at the proxy server.

@JordanRoberts1
Copy link

@boldt where did you add localhost to the NO_PROXY variable?

I'm running into this same issue, although using action, subosito/flutter-action@v2.2.0, not docker image, cirrusci/flutter.

I have systemProp.https.nonProxyHosts=localhost|127.0.0.1 in android/gradle.properties

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

3 participants