Http Google Cloud Run和Dart虚拟机上出现断管套接字异常(errno=32)
现在是2021年3月底,我的身份验证在我的linux(popOS)笔记本电脑上总是正常工作,在GCR上总是失败Http Google Cloud Run和Dart虚拟机上出现断管套接字异常(errno=32),http,authentication,dart,google-cloud-run,Http,Authentication,Dart,Google Cloud Run,现在是2021年3月底,我的身份验证在我的linux(popOS)笔记本电脑上总是正常工作,在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
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);
}
这很奇怪,因为身份验证在2021年2月初的GCR上运行得非常好,但在2021年3月中旬的GCR上开始失败
<>这看起来像是C++网络错误。我该如何进一步了解此问题或测试解决方案以解决此问题
我并没有忘记,我正在使用一种前端语言作为服务器端/中间件工具,该语言是为响应用户界面而构建的。我希望Dart对于全栈开发来说会很好,比如节点上的js或deno
我刚刚从GCR和docker那里找到了一些其他数据。GCR表示,它将从2016年1月10日起运行linux 4.4.0。我的笔记本电脑运行的是linux 5.11.0。您好,您能在
客户端
和then
子句之间添加代码吗?在下一个注释中,我将包含未生成消息32的代码。还有,以消息32结尾的请求数是多少?它们都是吗,只有部署后的第一批吗?var client=http.client();获取AccessCredentialsViaServiceAccount(accountCredentials,scopes,client)。然后((AccessCredentials){var tmp=credentials.toJson();打印('$tmp');//访问凭据在[credentials].client.close()中可用
我更新了顶层代码示例。GCR上的所有请求都会出错,出现断开的管道插座异常;不仅仅是部署后的第一次尝试。您是否打印并比较了变量saCreds
、作用域和、客户端本地和云中运行?以及变量的类型。您如何处理凭据.json文件?您是通过在请求中发送它来将其上载到cloud run?还是从云存储中提取?我还没有打印和比较VAR,但我很快就会打印出来。我使用gcloud cli将creds.json文件与部署的构建一起发布。
environment:
sdk: '>=2.9.0 <3.0.0'
dependencies:
googleapis_auth: ^1.1.0
http: ^0.13.1
FROM google/dart-runtime
ENV PORT 8080