简体   繁体   中英

Azure Functions fails running when deployed

I'm new here, sorry if the post is incomplete.

I'm trying to deploy a python script on azure that interacts with blobs. The script works fine in local: i can interact with my storage account, upload & download blobs... But when I deploy my function on azure, it won't run. The logs says no module named azure.storage exists.

Thing is, on my computer i had to pip install this module.

Should i add this module on azure web? How am I supposed to do such a thing?

I'm developping on Visual Studio Code using python 3.6.5.

Error listed in the invocations Details:

Result: Failure Exception: ModuleNotFoundError: No module named 'azure.storage'. Troubleshooting Guide: https://aka.ms/functions-modulenotfound Stack: File "/azure-functions-host/workers/python/3.7/LINUX/X64/azure_functions_worker/dispatcher.py", line 309, in _handle__function_load_request func_request.metadata.entry_point) File "/azure-functions-host/workers/python/3.7/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 42, in call raise extend_exception_message(e, message) File "/azure-functions-host/workers/python/3.7/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 40, in call return func(*args, **kwargs) File "/azure-functions-host/workers/python/3.7/LINUX/X64/azure_functions_worker/loader.py", line 85, in load_function mod = importlib.import_module(fullmodname) File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "/home/site/wwwroot/HttpTriggerTest/__init__.py", line 3, in <module> import HttpTriggerTest.dependance1 as dependance1 File "/home/site/wwwroot/HttpTriggerTest/__init__.py", line 4, in <module> import azure.storage.blob 

I hope someone can help me.

Sol 1: try setting environment variable FUNCTIONS_WORKER_RUNTIME to python

Sol 2: try adding azure.storage to your requirements.txt file

For further refer Ref1 , Ref2 , Ref3 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM