简体   繁体   English

Nest.js API + Cloud 上的 Google Cloud Storage 运行每个 GET 请求以触发“HTTP/2 框架层中的流错误”(POST 请求工作正常)

[英]Nest.js API + Google Cloud Storage on Cloud Run every GET request to trigger "Stream error in the HTTP/2 framing layer" (POST requests work fine)

I created a Nest.js API service that has an endpoint to upload a file to a Google Bucket.我创建了一个 Nest.js API 服务,它有一个端点可以将文件上传到 Google Bucket。 Everything works perfectly locally and also when using the local Docker image.在本地以及使用本地 Docker 图像时,一切都完美无缺。 Once I deploy (successfully) on Cloud Run, all GET requests return "Error: Stream error in the HTTP/2 framing layer" from Insomnia.一旦我在 Cloud Run 上部署(成功),所有 GET 请求都会从 Insomnia 返回“错误:HTTP/2 框架层中的 Stream 错误”。 The rest of the endpoints (POST, etc.) works perfectly.端点(POST 等)的 rest 工作正常。 I thought it was because I was using streams.我以为是因为我在使用流。 Therefore, I switched to normal file upload, but it did not help.因此,我切换到正常的文件上传,但没有帮助。

I am not using HTTP/2 in Nest.js and I do not need it.我没有在 Nest.js 中使用 HTTP/2,也不需要它。 I just need to upload a small file through the API.我只需要通过API上传一个小文件。

I tried enabling HTTP/2 on Cloud Run.我尝试在 Cloud Run 上启用 HTTP/2。 Did not help.没有帮助。 I remove the stream implementation and use the normal "upload".我删除了 stream 实现并使用正常的“上传”。 Did not help.没有帮助。

Could you please suggest a course of action?你能建议一个行动方案吗?

This error often appears when a server has HTTP/2 support however there is an intermediate reverse proxy that doesn't completely support HTTP/2 responses by the backend.当服务器支持 HTTP/2 但存在不完全支持后端 HTTP/2 响应的中间反向代理时,通常会出现此错误。 So the client and server negotiate an upgrade to HTTP/2, but in between the get expression breaks things.因此,客户端和服务器协商升级到 HTTP/2,但在 get 表达式之间破坏了一些东西。 Also the http/2 is always preferred when supported by both client and server.此外,当客户端和服务器都支持时,http/2 始终是首选。 To avoid this error,you can try to disable it using below:为避免此错误,您可以尝试使用以下方法禁用它:

handle_setopt(http_version = 2) (2 is the value for CURL_HTTP_VERSION_1_1)

Cloud Run is an HTTP Request/Response design. Cloud Run 是一个 HTTP 请求/响应设计。 This means that processing starts when you call the endpoint and ends when the endpoint returns.There is also a possibility as some APIs configurations and calling methods don't seem compatible with the latest HTTP version.这意味着处理在您调用端点时开始,在端点返回时结束。也有可能是某些 API 配置和调用方法似乎与最新的 HTTP 版本不兼容。 The newer version of CURL will use this protocol by default and as a result will fail.较新版本的 CURL 将默认使用此协议,因此会失败。 This can create some rather confusing behavior because a script that works on one machine may not necessarily work on another by default means what is used unless you set another version.这可能会产生一些相当混乱的行为,因为在一台机器上运行的脚本可能不一定在另一台机器上运行,默认情况下意味着使用什么,除非您设置另一个版本。 Thus, setting 1_1 as the protocol version required will override the default libcurl itself would use.因此,将 1_1 设置为所需的协议版本将覆盖默认的 libcurl 本身将使用的版本。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Blitz.js api 处理程序中运行时,Google Cloud Storage 调用失败并显示“error:0909006C:PEM routines:get_name:no start line” - Google Cloud Storage call fails with "error:0909006C:PEM routines:get_name:no start line" when run in Blitz.js api handler 将 blob 发布到谷歌云存储 - post blob to google cloud storage 我无法让谷歌云功能第 2 代仅处理来自 API 网关后面的授权请求 - I can't get google cloud functions gen 2 to work with only authorized requests from behind a API Gateway 从 Google API 网关到 Cloud Run 的请求延迟 - Delay on requests from Google API Gateway to Cloud Run HTTP 来自 Google Cloud 的 POST 功能 Node.js? - HTTP POST from Google Cloud Functions Node.js? Google Cloud 中的 EventArc 一次多次请求 Cloud Run Service 触发器 - EventArc in Google Cloud Request the Cloud Run Service more than Once in One Time Trigger 如何通过 cli / rest api / 云功能运行 Google Cloud Build 触发器? - How to run a Google Cloud Build trigger via cli / rest api / cloud functions? Python 和 HTTP Google Cloud Functions 上的“导入请求” - Python and "import requests" on HTTP Google Cloud Functions 在谷歌云中执行谷歌云 function 时出错,但在本地工作正常 - Error executing google cloud function in google cloud, but working fine in local 如何根据 HTTP 标头过滤对 Google Cloud Storage 的请求? - How can I filter requests to Google Cloud Storage depending on their HTTP headers?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM