启动 azure webapp 时出现 urllib3 错误

问题描述 投票:0回答:1

我正在尝试在 azure 上托管我的 Flask 应用程序。为此,我遵循了有关在 azure 上托管 Flask 应用程序的教程(我还使用了教程中给出的示例应用程序)。然后我运行命令:

az webapp up --runtime PYTHON:3.9 --sku B1 --logs

但收到以下消息:

`The webapp 'witty-coast-99cdf44e87c541d492a413bb27936a7c' doesn't exist
Creating AppServicePlan 'eivindkjosbakken_asp_1275' ...
Creating webapp 'witty-coast-99cdf44e87c541d492a413bb27936a7c' ...
Configuring default logging for the app, if not already enabled
Creating zip with contents of dir C:\Users\eivin\Documents\Programming\msdocs-python-flask-webapp-quickstart ...
Getting scm site credentials for zip deployment
Starting zip deployment. This operation can take a while to complete ...
Deployment endpoint responded with status code 202
You can launch the app at http://witty-coast-99cdf44e87c541d492a413bb27936a7c.azurewebsites.net
Configuring default logging for the app, if not already enabled
2023-09-05T13:39:46  Welcome, you are now connected to log-streaming service.
Exception in thread Thread-1 (_get_log):
Traceback (most recent call last):
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\urllib3/response.py", line 761, in _update_chunk_length
ValueError: invalid literal for int() with base 16: b''

在处理上述异常的过程中,又发生了一个异常:

Traceback (most recent call last):
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\urllib3/response.py", line 444, in _error_catcher
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\urllib3/response.py", line 828, in read_chunked
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\urllib3/response.py", line 765, in _update_chunk_length
urllib3.exceptions.InvalidChunkLength: InvalidChunkLength(got length b'', 0 bytes read)

在处理上述异常的过程中,又发生了一个异常:

Traceback (most recent call last):
  File "threading.py", line 1016, in _bootstrap_inner
  File "threading.py", line 953, in run
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/custom.py", line 2852, in _get_log
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\urllib3/response.py", line 624, in stream
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\urllib3/response.py", line 816, in read_chunked
  File "contextlib.py", line 153, in __exit__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\urllib3/response.py", line 461, in _error_catcher
urllib3.exceptions.ProtocolError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))`

我看到这是这个 GitHub 问题中提到的问题,但他们没有解决方案,也没有提到其他任何内容。

我的问题是,有谁知道如何解决这个问题(即使是临时解决方案也将受到高度赞赏)。

Azure CLI 版本:2.52.0。

安装requirements.txt中的软件包后运行pip list: 点击8.1.7 色彩0.4.6 烧瓶2.0.2 枪角兽21.2.0 危险2.1.2 金贾2 3.1.2 标记安全 2.1.3 包装 23.1 点 23.1.2 安装工具 65.5.0 Werkzeug 2.3.7

我尝试了几件事:不在 az webapp up 命令中指定 Python 版本(没有帮助)。我还尝试使用 az cache purge 清除缓存。我在想,如果我可以更改 azure 正在使用的 urllib3 包中的代码,那么我可能会找到一个临时解决方案,但我不确定如何更改此包(因为它是 azure 在运行 az webapp up 时自动使用的包)

azure flask web-hosting chunks urllib3
1个回答
0
投票

我已遵循您提供的相同 MS 文档。

最初我也遇到了同样的错误。

enter image description here

在您从 GitHub 克隆的应用程序的根目录中运行

az cache purge

enter image description here

  • 现在Web App已创建并成功上传文件。

  • 您可以看到正在运行的应用程序的日志流。

enter image description here

enter image description here

Az CLI 版本

enter image description here

输出:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.