Open matferrari-msft opened 1 year ago
FYI the feature flag was removed in https://github.com/Azure/azure-functions-host/issues/8847 and changes are rolling out very soon
I just posted the following question on SO:
https://stackoverflow.com/questions/75519932/azure-function-python-model-2-in-docker-container
I think I ran into the exact same problem. (func --version = 4.0.4895
)
is this still not working by default?
Maybe this isn't the place but I still can't get v2 to work at all in containers even with the AzureWebJobsFeatureFlags=EnableWorkerIndexing
@jellis18 If I remember correctly, you also need to add an env variable for the storage backend the runtime uses. I believe I used the emulator.
@matferrari-msft is that this? AzureWebJobsStorage=UseDevelopmentStorage=true
. If so, it still doesn't work. I'm just gonna use v1...
@jellis18 Yes, however, you would need to ensure that the emulator is actually accessible from within the container where the runtime is running. A potentially easier way is to just use a connection string. @ejizba @gavin-aguiar Are you able to provide any insights/guidance?
Mine worked a after I added the following lines in my docker file
FROM mcr.microsoft.com/azure-functions/python:4-python3.10
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true \
AzureWebJobsFeatureFlags=EnableWorkerIndexing \ # added by me
AzureWebJobsStorage='Add your conection string' #added by me
COPY requirements.txt /
RUN pip install -r /requirements.txt
COPY . /home/site/wwwroot
docker run -it --rm -p 8080:80 image_name
running into the same issue with python v2 in docker. can't get the functions to load
Thanks @MRuecklCC for the SO posted Q, this is what worked for me to start the docker container locally
FROM mcr.microsoft.com/azure-functions/python:4-python3.11
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true \
AzureWebJobsFeatureFlags=EnableWorkerIndexing \
AzureWebJobsStorage="UseDevelopmentStorage=true"
COPY requirements.txt /
RUN pip install -r /requirements.txt
COPY . /home/site/wwwroot
These 2 lines are manually added
AzureWebJobsFeatureFlags=EnableWorkerIndexing \
AzureWebJobsStorage="UseDevelopmentStorage=true"
I followed the suggested solutions, but still the functions don't get recognize, any other ideas?
I tried with http trigger it was okay, but when I add blob trigger, it was not found.
I have the same problem:
The command
func init --worker-runtime python -m V2 --docker
generates a Dockerfile without the env variableAzureWebJobsFeatureFlags=EnableWorkerIndexing
. This prevents the function from being indexed/run inside the container.