Hi @CP ,
Welcome to Microsoft Q&A!
I followed the steps available here to create a sample environment but was unable to reproduce this issue. Here are the high level steps that I performed
- Included sqlalchemy in requirements.txt file.
- Build the container and ran it (providing the required
AzureWebJobsStorage
as an environment variable).
- The
__init__.py
for TimerTrigger function is as below, ref: SQLAlchemy tutorial. import datetime
import logging
import sqlalchemy
from sqlalchemy import *
import azure.functions as func def main(mytimer: func.TimerRequest) -> None:
timestamp = datetime.datetime.now().isoformat()
if mytimer.past_due:
logging.info('The timer is past due!')
version = sqlalchemy.__version__
engine = create_engine('sqlite:///:memory:', echo=True)
logging.info('Python TimerTrigger function ran at %s', timestamp)
logging.info('sqlalchemy version = %s', version)
logging.info('sqlalchemy engine name = %s', engine.name)
-It did not throw the error as mentioned above and I got the expected output as well:
info: Function.TimerTrigger.User[0]
Python TimerTrigger function ran at 2021-09-29T13:41:00.010115
info: Function.TimerTrigger.User[0]
sqlalchemy version = 1.4.25
info: Function.TimerTrigger.User[0]
sqlalchemy engine name = sqlite
I was able to run the same code locally (outside container) as well without any issues. Can you please check if you are able to run this function app locally, outside of container? You may also use Visual Studio code to debug the error locally. Based on the error reported, it looks like the function.json file's binding could be incorrect for this function, causing this issue.
Please let me know if you have any questions.
Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.