小编Ben*_*ite的帖子

Google Cloud Run:错误:HTTP/2 帧层中的流错误

我使用https://www.starlette.io/和 docker 镜像创建了一个 API,python:3.7-slim-stretch并且在本地以及部署在 AWS ECS 上时一切正常。

但是当我尝试在 Google Cloud Run 上部署相同的应用程序时,我无法收到任何请求。我可以使用根域上的浏览器访问服务器,/但是当我尝试访问时,/prediction-url我收到诸如Error: Stream error in the HTTP/2 framing layer或 之类的响应错误Service unavailable。尝试使用 Insomnia、javascript 请求以及 curl 请求访问 API。奇怪的是,一切都在 AWS ECS 上 100% 运行,但我无法在 Googl Cloud Run 上运行。部署到 Google Cloud Run 时有什么具体需要考虑的吗?

请求路由定义:

@app.route("/classify-url", methods=["GET"])
@requires("authenticated")
async def classify_url(request):
    img_bytes = await get_bytes(request.query_params["url"])
    return await predict_image_from_bytes(img_bytes)
Run Code Online (Sandbox Code Playgroud)

服务器启动命令:

if __name__ == "__main__":
    if "serve" in sys.argv:
        # int(os.environ.get('PORT', 8080))
        uvicorn.run(app, host="0.0.0.0", port=8080, …
Run Code Online (Sandbox Code Playgroud)

google-cloud-platform google-cloud-run

1
推荐指数
1
解决办法
4507
查看次数