Hello all.
My Azure Function works well locally but it does not work when I published it.
Am not sure why it mentions that it could not find the module when it could work locally. Any ideas how to make it work?
Result: Failure Exception: ModuleNotFoundError: No module named 'poseidon'. Troubleshooting Guide: https://aka.ms/functions-modulenotfound Stack: File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/dispatcher.py", line 305, in _handle__function_load_request func = loader.load_function( File "/azure-functions-host/workers/python/3.9/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.9/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 40, in call return func(*args, **kwargs) File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/loader.py", line 83, in load_function mod = importlib.import_module(fullmodname) File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "/home/site/wwwroot/rafaAPI/__init__.py", line 5, in <module> from poseidon import poseidon
PYTHON CODE
import logging
import azure.functions as func
from poseidon import poseidon
def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
accessKey = 'XX'
secretKey = 'XX'
url = 'https://XX/app-portal-service/v2.0/login'
data = {"account": "XX", "password": "XX"}
req = poseidon.urlopen(accessKey, secretKey, url, data)
#name = 'mynameis'
#return func.HttpResponse(f"Hello, {name}. This HTTP triggered function executed successfully.")
return func.HttpResponse(f"Hello, {req['data']['accessToken']}. This HTTP triggered function executed successfully.")