You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

导入snowflake-snowpark-python后Azure Function部署成功但门户不显示的问题咨询

导入snowflake-snowpark-python后Azure Function部署成功但门户不显示的问题咨询

我最近在部署Azure Function时遇到了一个奇怪的问题:我用Python 3.9.12开发函数,需要引入snowflake-snowpark-python库,但只要代码里导入这个库并完成部署,函数就不会出现在Function App的门户中——如果去掉这个库的导入再发布,函数就能正常显示在门户里。

我的导入代码如下:

from snowflake.snowpark.session import Session
from snowflake.snowpark.functions import when_matched, when_not_matched,col

当前项目使用的依赖库版本清单:

aiohappyeyeballs==2.4.4
aiohttp==3.11.10
aiosignal==1.3.1
asn1crypto==1.5.1
async-timeout==5.0.1
attrs==24.2.0
azure-functions==1.21.3
azure-functions-durable==1.2.10
beautifulsoup4==4.12.3
boto3==1.35.77
botocore==1.35.77
certifi==2024.8.30
cffi==1.17.1
charset-normalizer==3.4.0
cloudpickle==2.0.0
cryptography==44.0.0
filelock==3.16.1
frozenlist==1.5.0
furl==2.1.3
greenlet==3.1.1
idna==3.10
jmespath==1.0.1
lxml==5.3.0
multidict==6.1.0
numpy==1.25.2
orderedmultidict==1.0.1
packaging==24.2
pandas==2.0.3
platformdirs==4.3.6
propcache==0.2.1
protobuf==5.29.1
pyarrow==18.1.0
pycparser==2.22
PyJWT==2.10.1
pyodbc==4.0.39
pyOpenSSL==24.3.0
python-dateutil==2.9.0.post0
pytz==2024.2
PyYAML==6.0.2
redshift-connector==2.1.4
requests==2.32.3
s3transfer==0.10.4
scramp==1.4.5
six==1.17.0
snowflake-connector-python==3.12.3
snowflake-snowpark-python==1.5.0
snowflake-sqlalchemy==1.5.1
sortedcontainers==2.4.0
soupsieve==2.6
SQLAlchemy==1.4.7
tomlkit==0.13.2
typing_extensions==4.12.2
tzdata==2024.2
tzlocal==5.2
urllib3==1.26.20
yarl==1.18.3

我测试过多个版本的snowflake-snowpark-python,结果都一样,目前用1.5.0是因为官方推荐这个版本。

现在我有两个问题想请教:

  • 有没有某个版本的snowflake-snowpark-python能让我正常发布Azure Function?
  • 整个发布过程没有任何警告或错误提示,有没有办法排查函数不在门户显示的原因?

我的完整函数代码如下:

# Register this blueprint by adding the following line of code 
# to your entry point file.  
# app.register_functions(blueprint) 
# 
# Please refer to https://aka.ms/azure-functions-python-blueprints


import azure.functions as func
import logging
from snowflake.snowpark.session import Session
from sqlalchemy.engine import URL
import os
import pandas as pd
import redshift_connector as connector
import json
from snowflake.snowpark.session import Session
from snowflake.snowpark.functions import when_matched, when_not_matched,col


blueprint = func.Blueprint()


@blueprint.route(route="http_trigger", auth_level=func.AuthLevel.FUNCTION)
def http_trigger(req: func.HttpRequest) -> func.HttpResponse:
    logging.info('Python HTTP trigger function processed a request.')

    name = req.params.get('name')
    if not name:
        try:
            req_body = req.get_json()
        except ValueError:
            pass
        else:
            name = req_body.get('name')

    if name:
        return func.HttpResponse(f"Hello, {name}. This HTTP triggered function executed successfully.")
    else:
        return func.HttpResponse(
             "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.",
             status_code=200
        )

解决方案

经过排查,问题出在snowflake.snowpark的依赖库cryptography上。我将cryptography的版本回退到43.0.3后,函数就能正常部署并在门户显示了。

备注:内容来源于stack exchange,提问作者harsh panday

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 16:44:54