broken pipe socket exception (errno=32) on Google Cloud Run and Dart vm

Viewed 642

Now in late March 2021, my authentication always works correctly on my linux (popOS) laptop and always fails on GCR.

  import 'package:googleapis_auth/auth_io.dart' as auth;
  import 'package:http/http.dart' as http;
    
  static Future<String> authAsync(final String jsonFilenamePath) {
    //
    final client = http.Client();

    return _getPrivateKeyAsync(jsonFilenamePath)
        .then((pk) => _buildJson(pk))
        .then((jason) => auth.ServiceAccountCredentials.fromJson(jason))
        // the next line will throw a broken pipe socket exception on GCR, but will run fine on my ubuntu laptop.
        .then((saCreds) => auth.obtainAccessCredentialsViaServiceAccount(saCreds, scopes, client), onError: _printErr)
        .whenComplete(() => client.close())
        .then((accessCredentials) => accessCredentials.accessToken.data);
  }

That method is more async/non-blocking so I tested another authentication method that was more of a synchronous/blocking style. Both fail for the same error on GCR. Both work great on my laptop every time I run it.

part of my pubspec.yaml...

environment:
  sdk: '>=2.9.0 <3.0.0' 
dependencies:
  googleapis_auth: ^1.1.0 
  http: ^0.13.1

The error on GCR...

Asynchroous error SocketException: OS Error: Broken pipe, errno = 32, address = accounts.google.com, port = 57210

My GCR docker file ...

FROM google/dart-runtime
ENV PORT 8080

It's strange because the authentication was working really well on GCR in early February 2021 but then it started to fail on GCR in mid-March 2021.

This looks like a C++ networking error to me. How might I learn more about this problem or test solutions to resolve it?

It is not lost on me that I am using a front-end language, built for responsive UI, as a server-side/middleware tool. I was hoping Dart would be great for full-stack development, like js on node or deno.

I just found some other stats from GCR and docker. GCR says it is running linux 4.4.0 from January 10 2016. My laptop is running linux 5.11.0.

0 Answers
Related