python - Azure功能部署失败: "Malformed SCM_RUN_FROM_PACKAGE when uploading built content"

标签 python azure azure-functions

我有两个 Azure 帐户。我尝试将相同的功能部署到这两个帐户(功能应用程序)。部署到第一个帐户 - 成功,但部署到第二个帐户 - 失败。

这两个帐户之间唯一的大区别是我无法直接访问第二个帐户的函数应用使用的资源组(我可以访问第一个帐户的资源组)。 这可能是我无法将程序部署到第二个帐户的函数应用程序的原因吗?

在第一个帐户部署函数应用的输出:

14:14:13 <func_name_1>: Starting deployment...
14:14:15 <func_name_1>: Creating zip package...
14:14:16 <func_name_1>: Zip package size: 597 kB
14:14:16 <func_name_1>: Fetching changes.
14:14:17 <func_name_1>: Cleaning up temp folders from previous zip deployments and extracting pushed zip file /tmp/zipdeploy/4c187dd4-7c93-41fb-939d-e2b4640f0cfe.zip (0.57 MB) to /tmp/zipdeploy/extracted
14:14:20 <func_name_1>: Updating submodules.
14:14:21 <func_name_1>: Preparing deployment for commit id '1a1eb1d0a9'.
14:14:21 <func_name_1>: Repository path is /tmp/zipdeploy/extracted
14:14:21 <func_name_1>: Running oryx build...
14:14:21 <func_name_1>: Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.7 -p packagedir=.python_packages/lib/site-packages
14:14:22 <func_name_1>: Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
14:14:22 <func_name_1>: You can report issues at https://github.com/Microsoft/Oryx/issues
14:14:22 <func_name_1>: Oryx Version: 0.2.20201015.1, Commit: 1a35fbce482b20b71290f3a837a3469803ce4b44, ReleaseTagName: 20201015.1
14:14:22 <func_name_1>: Build Operation ID: |WfYnvmAN2UQ=.793dc238_
14:14:22 <func_name_1>: Repository Commit : 1a1eb1d0a94943658cbb12b225071125
14:14:22 <func_name_1>: Detecting platforms...
14:14:23 <func_name_1>: Detected following platforms:
14:14:23 <func_name_1>:   python: 3.7.12
14:14:23 <func_name_1>: Version '3.7.12' of platform 'python' is not installed. Generating script to install it...
14:14:23 <func_name_1>: Warning: An outdated version of python was detected (3.7.12). Consider updating.
14:14:23 <func_name_1>: Versions supported by Oryx: https://github.com/microsoft/Oryx
14:14:23 <func_name_1>: Source directory     : /tmp/zipdeploy/extracted
14:14:23 <func_name_1>: Destination directory: /home/site/wwwroot
14:14:23 <func_name_1>: Downloading and extracting 'python' version '3.7.12' to '/tmp/oryx/platforms/python/3.7.12'...
14:14:24 <func_name_1>: Downloaded in 1 sec(s).
14:14:24 <func_name_1>: Verifying checksum...
14:14:24 <func_name_1>: Extracting contents...
14:14:27 <func_name_1>: Done in 4 sec(s).
14:14:28 <func_name_1>: Python Version: /tmp/oryx/platforms/python/3.7.12/bin/python3.7
14:14:28 <func_name_1>: Running pip install...
14:14:55 <func_name_1>: [13:14:55+0000] Successfully built psycopg2
14:14:55 <func_name_1>: [13:14:55+0000] Installing collected packages: azure-functions, numpy, six, python-dateutil, pytz, pandas, chardet, urllib3, idna, certifi, requests, pycparser, cffi, cryptography, PyJWT, msal, sqlalchemy, psycopg2, azure-core, isodate, oauthlib, requests-oauthlib, msrest, azure-storage-blob, pyasn1, pyasn1-modules, cachetools, rsa, google-auth, google-auth-oauthlib, pyarrow, setuptools, pydata-google-auth, protobuf, google-crc32c, google-resumable-media, googleapis-common-protos, grpcio, grpcio-status, google-api-core, proto-plus, pyparsing, packaging, google-cloud-core, google-cloud-bigquery, pandas-gbq
14:15:11 <func_name_1>: [13:15:11+0000] Successfully installed PyJWT-1.7.1 azure-core-1.22.1 azure-functions-1.9.0 azure-storage-blob-12.9.0 cachetools-5.0.0 certifi-2021.10.8 cffi-1.15.0 chardet-3.0.4 cryptography-3.4.6 google-api-core-2.5.0 google-auth-2.6.0 google-auth-oauthlib-0.5.0 google-cloud-bigquery-2.31.0 google-cloud-core-2.2.2 google-crc32c-1.3.0 google-resumable-media-2.3.0 googleapis-common-protos-1.55.0 grpcio-1.44.0 grpcio-status-1.44.0 idna-2.10 isodate-0.6.1 msal-1.8.0 msrest-0.6.21 numpy-1.19.1 oauthlib-3.2.0 packaging-21.3 pandas-1.1.0 pandas-gbq-0.16.0 proto-plus-1.20.3 protobuf-3.19.4 psycopg2-2.8.5 pyarrow-6.0.1 pyasn1-0.4.8 pyasn1-modules-0.2.8 pycparser-2.21 pydata-google-auth-1.3.0 pyparsing-3.0.7 python-dateutil-2.8.2 pytz-2021.3 requests-2.24.0 requests-oauthlib-1.3.1 rsa-4.8 setuptools-60.9.3 six-1.16.0 sqlalchemy-1.3.23 urllib3-1.25.10
14:15:11 <func_name_1>: WARNING: You are using pip version 20.2.3; however, version 22.0.3 is available.
14:15:11 <func_name_1>: You should consider upgrading via the '/tmp/oryx/platforms/python/3.7.12/bin/python3.7 -m pip install --upgrade pip' command.
14:15:11 <func_name_1>: Done in 43 sec(s).
14:15:11 <func_name_1>: Copying files to destination directory '/home/site/wwwroot'...
14:15:15 <func_name_1>: Done in 4 sec(s).
14:15:15 <func_name_1>: Removing existing manifest file
14:15:15 <func_name_1>: Creating a manifest file...
14:15:16 <func_name_1>: Manifest file created.
14:15:16 <func_name_1>: Done in 52 sec(s).
14:15:16 <func_name_1>: Running post deployment command(s)...
14:15:16 <func_name_1>: Triggering recycle (preview mode disabled).
14:15:16 <func_name_1>: Linux Consumption plan has a 1.5 GB memory limit on a remote build container.
14:15:16 <func_name_1>: To check our service limit, please visit https://learn.microsoft.com/en-us/azure/azure-functions/functions-scale#service-limits
14:15:16 <func_name_1>: Creating placeholder blob for linux consumption function app...
14:15:16 <func_name_1>: SCM_RUN_FROM_PACKAGE placeholder blob scm-latest-<func_name_1>.zip located
14:15:16 <func_name_1>: Writing the artifacts to a squashfs file
14:15:28 <func_name_1>: Parallel mksquashfs: Using 1 processor
14:15:28 <func_name_1>: Creating 4.0 filesystem on /home/site/artifacts/functionappartifact.squashfs, block size 131072.
14:15:31 <func_name_1>: [==================-                                           ] 2800/9135  30%
14:16:02 <func_name_1>: [====================/                                         ] 3000/9135  32%
14:16:07 <func_name_1>: [=============================================================\] 9135/9135 100%
14:16:07 <func_name_1>: Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
14:16:07 <func_name_1>:     compressed data, compressed metadata, compressed fragments, compressed xattrs
14:16:07 <func_name_1>:     duplicates are removed
14:16:07 <func_name_1>: Filesystem size 75358.45 Kbytes (73.59 Mbytes)
14:16:07 <func_name_1>:     29.67% of uncompressed filesystem size (253949.91 Kbytes)
14:16:07 <func_name_1>: Inode table size 84814 bytes (82.83 Kbytes)
14:16:07 <func_name_1>:     29.29% of uncompressed inode table size (289612 bytes)
14:16:07 <func_name_1>: Directory table size 84397 bytes (82.42 Kbytes)
14:16:07 <func_name_1>:     36.16% of uncompressed directory table size (233373 bytes)
14:16:07 <func_name_1>: Number of duplicate files found 521
14:16:07 <func_name_1>: Number of inodes 8873
14:16:07 <func_name_1>: Number of files 8006
14:16:07 <func_name_1>: Number of fragments 773
14:16:07 <func_name_1>: Number of symbolic links  0
14:16:07 <func_name_1>: Number of device nodes 0
14:16:07 <func_name_1>: Number of fifo nodes 0
14:16:07 <func_name_1>: Number of socket nodes 0
14:16:07 <func_name_1>: Number of directories 867
14:16:07 <func_name_1>: Number of ids (unique uids + gids) 1
14:16:07 <func_name_1>: Number of uids 1
14:16:07 <func_name_1>:     root (0)
14:16:07 <func_name_1>: Number of gids 1
14:16:07 <func_name_1>:     root (0)
14:16:07 <func_name_1>: Uploading built content /home/site/artifacts/functionappartifact.squashfs for linux consumption function app...
14:16:09 <func_name_1>: Resetting all workers for <func_name_1>.azurewebsites.net
14:16:09 <func_name_1>: Deployment successful.
14:16:28 <func_name_1>: Syncing triggers...
14:16:33 <func_name_1>: Querying triggers...
14:16:35 <func_name_1>: No HTTP triggers found.

在第二个帐户上部署函数应用的输出:

16:38:30 <func_name_2>: Starting deployment...
16:38:33 <func_name_2>: Creating zip package...
16:38:34 <func_name_2>: Zip package size: 597 kB
16:38:35 <func_name_2>: Fetching changes.
16:38:36 <func_name_2>: Cleaning up temp folders from previous zip deployments and extracting pushed zip file /tmp/zipdeploy/edc7f1e2-d15f-4e62-ad4a-abe9993f4fbe.zip (0.57 MB) to /tmp/zipdeploy/extracted
16:38:38 <func_name_2>: Updating submodules.
16:38:39 <func_name_2>: Preparing deployment for commit id '87613accff'.
16:38:39 <func_name_2>: Repository path is /tmp/zipdeploy/extracted
16:38:39 <func_name_2>: Running oryx build...
16:38:39 <func_name_2>: Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.7 -p packagedir=.python_packages/lib/site-packages
16:38:41 <func_name_2>: Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
16:38:41 <func_name_2>: You can report issues at https://github.com/Microsoft/Oryx/issues
16:38:41 <func_name_2>: Oryx Version: 0.2.20201015.1, Commit: 1a35fbce482b20b71290f3a837a3469803ce4b44, ReleaseTagName: 20201015.1
16:38:41 <func_name_2>: Build Operation ID: |y5J5WXgD8ag=.a9990db3_
16:38:41 <func_name_2>: Repository Commit : 87613accff174b0189b03a7e7bd5845c
16:38:41 <func_name_2>: Detecting platforms...
16:38:43 <func_name_2>: Detected following platforms:
16:38:43 <func_name_2>:   python: 3.7.12
16:38:43 <func_name_2>: Version '3.7.12' of platform 'python' is not installed. Generating script to install it...
16:38:44 <func_name_2>: Warning: An outdated version of python was detected (3.7.12). Consider updating.
16:38:44 <func_name_2>: Versions supported by Oryx: https://github.com/microsoft/Oryx
16:38:44 <func_name_2>: Source directory     : /tmp/zipdeploy/extracted
16:38:44 <func_name_2>: Destination directory: /home/site/wwwroot
16:38:44 <func_name_2>: Downloading and extracting 'python' version '3.7.12' to '/tmp/oryx/platforms/python/3.7.12'...
16:38:45 <func_name_2>: Downloaded in 1 sec(s).
16:38:45 <func_name_2>: Verifying checksum...
16:38:45 <func_name_2>: Extracting contents...
16:38:51 <func_name_2>: Done in 7 sec(s).
16:38:51 <func_name_2>: Python Version: /tmp/oryx/platforms/python/3.7.12/bin/python3.7
16:38:51 <func_name_2>: Running pip install...
16:39:22 <func_name_2>: [15:39:22+0000] Successfully built psycopg2
16:39:22 <func_name_2>: [15:39:22+0000] Installing collected packages: six, chardet, urllib3, certifi, idna, requests, azure-core, azure-functions, oauthlib, requests-oauthlib, isodate, msrest, pycparser, cffi, cryptography, azure-storage-blob, cachetools, pyasn1, pyasn1-modules, rsa, google-auth, protobuf, googleapis-common-protos, google-api-core, google-auth-oauthlib, pyparsing, packaging, proto-plus, python-dateutil, google-crc32c, google-resumable-media, google-cloud-core, grpcio, google-cloud-bigquery, google-cloud-bigquery-storage, grpcio-status, PyJWT, msal, numpy, pytz, pandas, pyarrow, setuptools, pydata-google-auth, pandas-gbq, psycopg2, SQLAlchemy
16:39:40 <func_name_2>: [15:39:40+0000] Successfully installed PyJWT-1.7.1 SQLAlchemy-1.3.23 azure-core-1.22.1 azure-functions-1.9.0 azure-storage-blob-12.9.0 cachetools-5.0.0 certifi-2021.10.8 cffi-1.15.0 chardet-3.0.4 cryptography-3.4.6 google-api-core-2.5.0 google-auth-2.6.0 google-auth-oauthlib-0.4.6 google-cloud-bigquery-2.31.0 google-cloud-bigquery-storage-2.12.0 google-cloud-core-2.2.2 google-crc32c-1.3.0 google-resumable-media-2.2.1 googleapis-common-protos-1.54.0 grpcio-1.44.0 grpcio-status-1.44.0 idna-2.10 isodate-0.6.1 msal-1.8.0 msrest-0.6.21 numpy-1.19.1 oauthlib-3.2.0 packaging-21.3 pandas-1.1.0 pandas-gbq-0.16.0 proto-plus-1.20.3 protobuf-3.19.4 psycopg2-2.8.5 pyarrow-6.0.1 pyasn1-0.4.8 pyasn1-modules-0.2.8 pycparser-2.21 pydata-google-auth-1.3.0 pyparsing-3.0.7 python-dateutil-2.8.2 pytz-2021.3 requests-2.24.0 requests-oauthlib-1.3.1 rsa-4.8 setuptools-60.9.3 six-1.16.0 urllib3-1.25.10
16:39:40 <func_name_2>: WARNING: You are using pip version 20.2.3; however, version 22.0.3 is available.
16:39:40 <func_name_2>: You should consider upgrading via the '/tmp/oryx/platforms/python/3.7.12/bin/python3.7 -m pip install --upgrade pip' command.
16:39:40 <func_name_2>: Done in 49 sec(s).
16:39:40 <func_name_2>: Copying files to destination directory '/home/site/wwwroot'...
16:39:46 <func_name_2>: Done in 6 sec(s).
16:39:46 <func_name_2>: Removing existing manifest file
16:39:46 <func_name_2>: Creating a manifest file...
16:39:46 <func_name_2>: Manifest file created.
16:39:46 <func_name_2>: Done in 62 sec(s).
16:39:47 <func_name_2>: Running post deployment command(s)...
16:39:50 <func_name_2>: Triggering recycle (preview mode disabled).
16:39:53 <func_name_2>: Linux Consumption plan has a 1.5 GB memory limit on a remote build container.
16:39:54 <func_name_2>: To check our service limit, please visit https://learn.microsoft.com/en-us/azure/azure-functions/functions-scale#service-limits
16:39:54 <func_name_2>: Creating placeholder blob for linux consumption function app...
16:39:54 <func_name_2>: Malformed SCM_RUN_FROM_PACKAGE when uploading built content.
16:40:19 <func_name_2>: Deployment failed.

第二个帐户上的函数应用刚刚在部署过程之前创建。我尝试将其部署到同一帐户上的另一个函数应用程序 - 同样的错误。

我也尝试过 here 中提到的方法.

我在第二个帐户的函数应用程序中运行了命令:

func azure functionapp publish <func_name_2> --build remote

输出是: output of --build remote 该函数应用程序是 2 天前创建的。如果资源组创建日期早于上述2019年8月1日,是否会导致此问题? (我不知道资源组创建的日期)

然后,我运行命令:

func azure functionapp publish <func_name_2> --build local

我收到错误: outpu of --build local 对我来说,这个错误没有任何意义,因为这个程序部署在第一个帐户的功能应用程序上。

PS:两个帐户的两个功能应用上的配置是相同的。

欢迎提供有关如何解决此问题的任何提示。

最佳答案

问题出在函数应用程序创建中。

  • 部署不适用于通过 Azure 门户创建的函数应用。
  • 部署适用于通过 Visual Studio Code 创建的函数应用。

*两个选项的参数设置相同。

但我仍然对功能应用程序创建发生这种差异的原因感兴趣。

关于python - Azure功能部署失败: "Malformed SCM_RUN_FROM_PACKAGE when uploading built content",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71289045/

相关文章:

python - 如何增加打印的每行新行的前导空格数?

azure - 使用租户 ID 自动登录 azcopy 失败

c# - 使用 .NET 5 调用受 Azure B2C 保护的 Web API

Azure 认知搜索使用情况监控

azure - Azure Function 的服务总线触发器是否需要管理对服务总线队列/主题的访问权限?

python - 使用 Intel MKL 计算 `trans(a)*inv(b)*a` 的正确方法(后续问题)

python - Function() 正好接受 2 个参数(给定 3 个)

python - 输入包含 NaN、无穷大或对于 dtype ('float64' 来说太大的值)但没有 nan 或无穷大值

Azure AD : include custom field in id_token

c# - 进程无法访问该文件,因为它正在被另一个进程在第二次调用时使用