Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker + Azure V2 Python model issue: No job functions found #1028

Open
yakutsa opened this issue Jan 21, 2024 · 1 comment
Open

Docker + Azure V2 Python model issue: No job functions found #1028

yakutsa opened this issue Jan 21, 2024 · 1 comment

Comments

@yakutsa
Copy link

yakutsa commented Jan 21, 2024

Using M1 chip via MacBook Air, so I have to use Docker to avoid compatibility issues. I did a very small set-up via Azure functions v2 - blueprint & function - however I am facing issues with the same error despite many many attemps: no job functions found.

Here's the codes:

Dockerfile

FROM mcr.microsoft.com/azure-functions/python:4-python3.10

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

host.json

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[4.*, 5.0.0)"
  }
}

blueprint.py

import azure.functions as func
import logging

bp = func.Blueprint()

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

    # Simply return a 'Hello World' message
    return func.HttpResponse(
        "Hello World",
        status_code=200
    )

function_app.py

import azure.functions as func
from blueprint import bp

app = func.FunctionApp()
app.register_functions(bp)

# Logging to confirm registration
logging.info("Functions registered successfully.")

Docker build and run successful without any log errors only with a warning message:

warn: Host.Startup[0]
No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).

I know one solution is to use v1 as there are more documentations available and more reusable codes however that support is going to end in 2026. Is there anything I am missing to fix the above issue? If not, then I will switch it to v1.

I even tried building:

docker build --no-cache -t containername .

that also didn't work.

@yakutsa yakutsa changed the title Docker + Azure issue: No job functions found Docker + Azure Functions v2 issue: No job functions found Jan 21, 2024
@yakutsa yakutsa changed the title Docker + Azure Functions v2 issue: No job functions found Docker + Azure issue: No job functions found Jan 21, 2024
@yakutsa yakutsa changed the title Docker + Azure issue: No job functions found Docker + Azure V2 Python model issue: No job functions found Jan 21, 2024
@sudharsan2020
Copy link

Can you please try this #987 (comment) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants