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

Azure function python v2 with external packages HTTP Trigger not visible in Azure Portal after deployment #1262

Open
SiddheshDesai06 opened this issue Jun 13, 2023 · 108 comments

Comments

@SiddheshDesai06
Copy link

Refer this SO Thread and my answer - https://stackoverflow.com/questions/76458717/why-is-the-functions-runtime-not-finding-my-functions-when-i-import-certain-pack/76463210?noredirect=1#> The Azure python Function with V2 programming model including external packages and imports in function_app.py works locally, But when I deploy it in Azure the Function Trigger is not visible. If I deploy default HTTP Trigger with python v2 programming model, The trigger is visible after deployment. But not when i add custom imports in the function_app.py and requirements.txt. Refer this image - https://i.imgur.com/CjCnsY8.png but the function files are visible in app files like here- https://i.imgur.com/R3SZWcW.png . I tried the deployment with App service plan and consumption plan both, Still no luck. I also added AzureWebJobsFeatureFlags:EnableWorkerIndexing settings, I also tried to deploy this function as zip using azure cli zip command with required settings to deploy function as zip, I also tried to deploy it with function core tools func azure functionapp publish command and also via VS code still no luck.

Investigative information

Please provide the following:
  • Timestamp:
  • Function App name: siliconfunc311
  • Function name(s) (as appropriate): Http trigger pythonv2
  • Core Tools version:4.0.5148

Repro steps

Provide the steps required to reproduce the problem:

Refer this SO thread and my answer- https://stackoverflow.com/questions/76458717/why-is-the-functions-runtime-not-finding-my-functions-when-i-import-certain-pack/76463210?noredirect=1#comment134830419_76463210

Expected behavior

Provide a description of the expected behavior.

after deployment HTTP trigger should be visible in Azure portal

Actual behavior

Provide a description of the actual behavior observed.

Function trigger is not visible in Functions section of Function tab but files are visible in app files

Known workarounds

Provide a description of any known workarounds.

Contents of the requirements.txt file:

Provide the requirements.txt file to help us find out module related issues.

numpy

pandas

opencv-python-headless

librosa

torch

torchaudio

torch-audiomentations

torchvision

azure-functions

Related information

Provide any related information
  • Links to source

https://stackoverflow.com/questions/76458717/why-is-the-functions-runtime-not-finding-my-functions-when-i-import-certain-pack/76463210?noredirect=1#comment134830419_76463210

# function_app.py

import logging
import azure.functions as func
import numpy as np
import pandas as pd
import cv2
import librosa
import torch
import torchaudio
import torch_audiomentations
import torchvision
from azure.functions import HttpRequest


app = func.FunctionApp(http_auth_level=func.AuthLevel.FUNCTION)



@app.route(route="HttpTrigger")
def HttpTrigger(req: func.HttpRequest) -> func.HttpResponse:
    logging.info('Python HTTP trigger function processed a request.')

    #code block with imported packages 
    arr = np.array([1, 2, 3])
    df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})
    image = cv2.imread('Screenshot (1).png')
    audio_data, sample_rate = librosa.load('sample.wav.mp3')
    tensor = torch.tensor([1, 2, 3])
    transformed_tensor = torch_audiomentations.PitchShift(sample_rate=sample_rate, p=1.0)
    torchvision.transforms.ToTensor()(image)

    name = req.params.get('name')
    if not name:
        try:
            req_body = req.get_json()
        except ValueError:
            pass
        else:
            name = req_body.get('name')

    if name:
        return func.HttpResponse(f"Hello, {name}. This HTTP triggered function executed successfully.")
    else:
        return func.HttpResponse(
             "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.",
             status_code=200
        )
@VirajVaitha123
Copy link

Did this problem start recently?

I had a v2 programming function app deployed that was working fine, however last night i made some changes and I can no longer see the functions. I've tried everything and attempting to revert to the old code but I can't seem to see what is different.

Maybe Azure have made some changes that have impacted us?

@bhagyshricompany bhagyshricompany self-assigned this Jun 14, 2023
@bhagyshricompany
Copy link

@VirajVaitha123 thanks for informing and can you share the function name,region,invocationid etc.
So I can investigate same at our end.

@cghgreg
Copy link

cghgreg commented Jun 14, 2023

I'm the author of the SO question and wanted to add that I found this issue only applies when deploying to a consumption plan. When I deploy to a dedicated app service plan, the functions load.

@VirajVaitha123
Copy link

@VirajVaitha123 thanks for informing and can you share the function name,region,invocationid etc. So I can investigate same at our end.

Sure

function name : scryptifyf1
region: north europe,
invocationid: (I can't find this)..

@bhagyshricompany
Copy link

@VirajVaitha123 Thanks for input I will update once check

@VirajVaitha123
Copy link

Thanks for looking into this.

Do we know if this problem is one multiple people are facing, and there is nothing we can do to deploy with Python v2 programming model?

@bhagyshricompany
Copy link

@VirajVaitha123 pls share the start time and end time

@MT--
Copy link

MT-- commented Jun 19, 2023

I have been experiencing the exact same issue for over a week - I have tried the different deployment methods, as well as deleting and recreating the Function App and App Service Plan.

@cghgreg
Copy link

cghgreg commented Jun 19, 2023

Only workaround I know is to switch to the V1 programming model.

@bhagyshricompany
Copy link

@gavin-aguiar pls comment

@ghost
Copy link

ghost commented Jun 24, 2023

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@Laura10101
Copy link

Laura10101 commented Jun 27, 2023

I'm experiencing a similar issue but with two differences:

  1. I'm using a timer trigger rather than an HTTP trigger
  2. I'm getting the error '1 found, 0 loaded" in my logging as opposed to the error displayed in the SO post.

One additional thing I've noticed when I've probed around in my portal is that Genie is reporting the following error:

Worker failed to index functions
Result: Failure Exception: ImportError: cannot import name '_imaging' from 'PIL' (/home/site/wwwroot/.python_packages/lib/site-packages/PIL/init.py). Troubleshooting Guide: https://aka.ms/functions-modulenotfound Stack: File '/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/dispatcher.py', line 338, in _handle__functions_metadata_request fx_metadata_results = self.index_functions(function_path) File '/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/dispatcher.py', line 607, in index_functions indexed_functions = loader.index_function_app(function_path) File '/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/utils/wrappers.py', line 48, in call raise extend_exception_message(e, message) File '/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/utils/wrappers.py', line 44, in call return func(*args, **kwargs) File '/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/loader.py', line 151, in index_function_app imported_module = importlib.import_module(module_name) File '/usr/local/lib/python3.10/importlib/init.py', line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File '', line 1050, in _gcd_import File '', line 1027, in _find_and_load File '', line 1006, in _find_and_load_unlocked File '', line 688, in _load_unlocked File '', line 883, in exec_module File '', line 241, in _call_with_frames_removed File '/home/site/wwwroot/function_app.py', line 2, in from core.data.training_image_filestore import TrainingImageFilestore File '/home/site/wwwroot/core/data/training_image_filestore.py', line 1, in from PIL import Image File '/home/site/wwwroot/.python_packages/lib/site-packages/PIL/Image.py', line 103, in from . import _imaging as core

That is followed by this error:

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.).

The key thing that strikes me as odd here is that it's failing to import the package from /home/site/wwwroot/.python_pacakages/...

Looking in my storage account, the reason it's failing is obvious - there's no .python_packages file in wwwroot.

After liaising with the OP of this github issue on my own SO post, we're using identical Azure Pipeline YAML definitions. The key thing is we're both running from zip packages, rather than deploying the code directly so I wouldn't expect there to be anything in wwwroot.

Since my function_app.py file imports a load of custom packages (which in turn import PIL), and does so before declaring the function, my thinking is that the imports are erroring about because Python should be looking for them in the package but is actually looking for them in the site root (working directory). Since they aren't there, it errors out so never makes it as far as far as the function app declaration.

Just a guess but given the errors it would make sense.

What to do about that, however, I don't know!

For now it looks like the two workarounds are:

  1. Downgrade to v1 programming model
  2. Swap to a dedicated ASP rather than consumption plan

I followed the first of these options and this resolved my issue.

@ghost
Copy link

ghost commented Jul 1, 2023

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@Otimkev
Copy link

Otimkev commented Jul 1, 2023

I'm facing the same challenge over here using python. The Function HTTP triggers are not visible in Functions section of Function tab but files are visible in App files.

@ghost ghost removed the no recent activity label Jul 1, 2023
@sid24desai
Copy link

@bhagyshricompany Can you take a look at this issue? I see multiple customers facing this issue?

@ghost ghost added the no recent activity label Jul 7, 2023
@ghost
Copy link

ghost commented Jul 7, 2023

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost ghost closed this as completed Jul 10, 2023
@MikeJerred
Copy link

This is still an issue, I am seeing it happen on occasion. As of yet cannot figure out a pattern for why it happens or how to fix it.

@ghost ghost removed the no recent activity label Jul 21, 2023
@SiddheshDesai06
Copy link
Author

@bhagyshricompany Can you check this issue? Looks like its a bug, Multiple customers are reporting it?

@ghost ghost added the needs-attention 👋 label Jul 21, 2023
@joe-plumb
Copy link

joe-plumb commented Jun 10, 2024 via email

@SjoerdTimovanVliet
Copy link

Anyone got it working?

@JackDDavis
Copy link

@SjoerdTimovanVliet, yes, with the changes I've mentioned above (though I've opted for the latest version rather than v2). Please see the installation guidance at https://www.psycopg.org/install/

@mboling6
Copy link

mboling6 commented Jul 15, 2024

I am trying to deploy a function app using the Flex Consumption plan. I have tried using the v1 model, v2 model, and reverted back to the simple HttpExample with no external python modules, yet I still do not see any of my http triggers. I am correctly using the WEBSITE_RUN_FROM_PACKAGE environment variable and have it linked to the blob of the zip containing the function app code. I manually sync the triggers as part of my deployment pipeline as well. I have tried everything that @JackDDavis tried + more, and currently have no external modules, yet I still see nothing. In the trace logs I get 1 functions found. 0 function loaded. 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.). Because this is a Flex Consumption plan, I am unable to see more detailed logs as @BillmanH suggests. Any insights would be much appreciated.

@BillmanH
Copy link

1 functions found. 0 function loaded. No job functions found. , is most likely an issue with your code, and most likely either A) a module that is not in your requirements, or B) a variable declared outside of the function scope.

I wrote a more comprehensive troubleshooting guide. But, there isn't much else I can do without seeing your code.
https://github.com/BillmanH/exoplanets/blob/main/docs/Troubleshooting_azure_functions.md#how-to-see-the-specific-error

even with the Flex plan, you should still be able to access the diagnostic tools.

@mboling6
Copy link

mboling6 commented Jul 15, 2024

@BillmanH I switched my function app code to mimic the HttpExample template so that I would know if its a module error:

import azure.functions as func

app = func.FunctionApp()

@app.route(route="HttpExample", auth_level=func.AuthLevel.ANONYMOUS)
def HttpExample(req: func.HttpRequest) -> func.HttpResponse:
    name = req.params.get('name')
    if not name:
        try:
            req_body = req.get_json()
        except ValueError:
            pass
        else:
            name = req_body.get('name')

    if name:
        return func.HttpResponse(f"Hello, {name}. This HTTP triggered function executed successfully.")
    else:
        return func.HttpResponse(
             "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.",
             status_code=200
        )

I still cannot see this simple trigger in the function app. After reading this thread I thought it was a python module error, but this makes me think it is not.

I was able to access the 'function not triggering' diagnostic tools, but it says this when I click on it: 'Thank you for testing the Flex Consumption plan public preview, this detector will be updated soon.'

@BillmanH
Copy link

BillmanH commented Jul 15, 2024

I empathize. Are you able to run the function locally in the diagnostic tools? My other thoughts is that it could be an issue with your host.json file, or configuration somehow. However, it also sounds like the consumption plan is in public preview, which could mean that you have an altogether new issue that isn't a good match for this issue thread.

@mboling6
Copy link

@BillmanH I am able to run the function locally. I believe that my host.json is alright:

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

I am starting to worry it may just be an issue with the flex consumption plan. The odd things is what by deploying through the Azure VSCode extension, I can see all the triggers fine, and then as soon as I redeploy the resources via Bicep, they disappear.

@BillmanH
Copy link

Can you try adding a list of functions in that script that you want to load?

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

@MarthinusBosman
Copy link

I just want to specifically thank @BillmanH , this has been a plague on my existence the last few days until I finally saw your comment.

@ldibanyez
Copy link

Just another kudos to @BillmanH for redirecting a lost brother back to the light.

If you are a newbie that created a toy app with "func init", it is essential to update the requirements.txt file before deploying with:

pip freeze > requirements.txt

if you just add the names of the packages without the version numbers (as a newbie could think is the right way after inspecting the auto-generated requirements.txt, that only has "azure-functions" listed), you are in for trouble.

@chrisranderson
Copy link

My problem was with FastAPI + Function Apps. Everything worked fine locally, but when I deployed, it all looked fine (no error logs I could find) but there would be no actual functions/my API would return 404s. It's probably due to uncaught, top-level errors (i.e. at module load time).

If you can't use a different service, I recommend starting with this: https://github.com/Azure-Samples/fastapi-on-azure-functions, and very slowly moving your code over into that repo, committing each time you get it working. You'll be able to find what bit of code is problematic that way.

@derik-roby
Copy link

Thanks @BillmanH !!

In my case, I did not set my environment variables in Azure Portal.
My understanding was we could set the env variables after deploying the app. I was wrong.

@Steffanic
Copy link

Can you try adding a list of functions in that script that you want to load?

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

This was absolutely the solution that worked for me! Thank you so much!

@jonathanlal
Copy link

pip freeze > ./requirements.txt

thank you! jesus christ that had me worried. Hail satan.

@mathieuisabel
Copy link

mathieuisabel commented Nov 1, 2024

In my case, it appears there was a mismatch between the python version in Az Pipeline ubuntu-latest and what the function app instance was running in Azure. Pinning the python version in the pipeline before installing the packages with pip seems to have resolved the issue. ex.

  jobs:
  - job: Build
    displayName: Build
    pool:
      vmImage: $(vmImageName)

    steps:
    - task: UsePythonVersion@0
      displayName: 'Use Python 3.11'
      inputs:
        versionSpec: 3.11
    - bash: |
        pip install --target="./.python_packages/lib/site-packages" -r ./requirements.txt
      workingDirectory: $(workingDirectory)

That took me a while to figure that one out as the logs were not helpful. i.e. You could see the modules couldn't be found while the function app was starting up but when you look at the build zip file, everything was in the right spot under .python_packages/**

Edit:
I saw how the python version was pinned here: python-functionapp-to-linux-on-azure.yml

@klettg
Copy link

klettg commented Nov 11, 2024

Adding my experience and solution FWIW.

Similar to many people I was having issues once I added external packages. But the errors are lost due to the above mentioned azure functions poor design, and the function still deploys correctly. The only logs I could see would say:

info: Host.Startup[315]
      0 functions loaded
info: Host.Startup[0]
      Generating 0 job function(s)
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.).
info: Microsoft.Azure.WebJobs.Script.WebHost.WebScriptHostHttpRoutesManager[0]
      Initializing function HTTP routes
      No HTTP routes mapped

My solution - put the imports in a try/catch, do not raise the error so the function deploys correctly, but set it to a global variable (initialization_error).

Add a /health endpoint, and return the error that happens during initialization, as well as other debug info (used pandas as the test import here.

import logging
import azure.functions as func
import sys
import os
from importlib.metadata import distributions
import json
import traceback

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

# Initialize the FunctionApp before any other initialization
app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)

# Global variables to track initialization status
services_initialized = False
initialization_error = None

try:
    import pandas as pd
    logger.info("All services initialized successfully")
except Exception as e:
    initialization_error = str(e)
    logger.error(f"Initialization error: {str(e)}")
    # Don't raise - let the functions register

@app.function_name("health")
@app.route(route="health", methods=["GET"])
def health_check(req: func.HttpRequest) -> func.HttpResponse:
    try:
        health_info = {
            "status": "available",
            "initialization": {
                "services_initialized": services_initialized,
                "initialization_error": initialization_error,
            },
            "environment": {
                "python_version": sys.version,
                "current_directory": os.getcwd(),
                "python_path": sys.path,
                "environment_variables": {
                    "PYTHONPATH": os.getenv("PYTHONPATH", "not set"),
                    "AzureWebJobsScriptRoot": os.getenv("AzureWebJobsScriptRoot", "not set"),
                    "WEBSITE_SITE_NAME": os.getenv("WEBSITE_SITE_NAME", "not set"),
                },
            },
            "filesystem": {
                "directory_contents": os.listdir(),
                "wwwroot_contents": (
                    os.listdir("/home/site/wwwroot") if os.path.exists("/home/site/wwwroot") else "not found"
                ),
            },
            "dependencies": {
                "installed_packages": [f"{dist.metadata['Name']}=={dist.version}" for dist in distributions()],
                "pandas_version": pd.__version__ if "pd" in globals() else "not imported",
            },
        }

        return func.HttpResponse(json.dumps(health_info, indent=2), mimetype="application/json")
    except Exception as e:
        error_info = {
            "status": "error",
            "error_type": type(e).__name__,
            "error_message": str(e),
            "error_traceback": traceback.format_exc(),
        }
        logger.error(f"Health check failed: {str(e)}")
        return func.HttpResponse(json.dumps(error_info, indent=2), status_code=500, mimetype="application/json")

In my personal case, the actual error that was getting swallowed by azure functions became clear from this health_check response. It was
a mismatch in compatible versions between numpy and pandas.

{
    "status": "available",
    "initialization": {
        "services_initialized": false,
        "initialization_error": "numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject"
    },

So while ultimately my fault, azure functions made it a PITA to debug. Hope this helps someone else!

@alphanewton
Copy link

alphanewton commented Nov 13, 2024

Like everyone, I have the same error and the main error log states - "No job functions found. Try making your classes and methods public". This is very vague, so I tried all the methods listed above but was unable to resolve the issue. So, I tried @klettg function and added in my dependencies but was having the same issues. Some note-worthy points:

  1. The function app works in staging and any other new function app but not in production env(on the client) which is pushed through Azure DevOps.
  2. I think it comes down to my requirements file (Which is attached below) or the old cached modules of the function app.
  3. The current code was an async implementation as opposed to the previously synced version

azure-functions azure-storage-blob pytz python-dotenv azure-search-documents azure-storage-file-share aiohttp requests beautifulsoup4 --- requirements.txt

Can anyone please help?

@AhHanie
Copy link

AhHanie commented Nov 21, 2024

I wanted to share my experience with this issue. I encountered the same error: "No job functions found. Try making your classes and methods public." Despite trying various solutions, nothing seemed to work. Here are the steps I took to resolve this issue:

  1. Access the SSH Web Interface:

    • In the Azure Portal, navigate to your function app page.
    • Go to Development Tools -> SSH on the side menu.
  2. Navigate to the Project Directory:

    cd ~/site/wwwroot
  3. Install Azure Functions Package:

    apt-get install azure-functions-core-tools-4
  4. Start the Project Using the Local Environment Command:

    func host start

After doing all that, I got the following error:

Exception: SyntaxError: f-string: unmatched '[' (file.py, line 83)

Offending Line of Code:

text += f"{node["value"]}"

The issue arises because Azure function app servers use Python 3.11, where f-strings with double quotes inside double quotes are not allowed. This kind of syntax is fixed in Python 3.13.

I hope this helps others facing the same problem. Why was this error not logged in the application's logs? It would have saved me countless hours of debugging.

@kpatwa
Copy link

kpatwa commented Nov 28, 2024

kudos to @BillmanH
pip freeze > ./requirements.txt
Worked for me like a hero.

@carlosxjunior
Copy link

@AhHanie this comment is a blessing! Running locally was working for me but deploying to the cloud was not, then I tried running locally in a different machine and it failed with the f-string error, but I didn't know double quotes were not allowed.
Thank you!
Also thanks @BillmanH, adding the functions to host.json was the secret for me. Now I'm just struggling to deploy using Azure Pipelines.

@bastienjalbert
Copy link

bastienjalbert commented Dec 21, 2024

I wanted to share my experience with this issue. I encountered the same error: "No job functions found. Try making your classes and methods public." Despite trying various solutions, nothing seemed to work. Here are the steps I took to resolve this issue:

  1. Access the SSH Web Interface:
    .......................

I hope this helps others facing the same problem. Why was this error not logged in the application's logs? It would have saved me countless hours of debugging.

Sadly, no ssh in free consumption plan (Y1).... But the solution seems great
For those with consumption plan, you may try klettg message (#1262 (comment)), putting import in a try/except + add an anon endpoint to return the error (a real waste of time, but it works 🥇 )

@DanielMOliveira
Copy link

What worked for me was to make sure that the requirements were installed in the correct folder.

pip install --target=‘./FunctionApp1/.python_packages/lib/site-packages’ -r ./FunctionApp1/requirements.txt

When I added this to the pipeline, all the functions became visible again in the Azure portal

@kollerp
Copy link

kollerp commented Jan 18, 2025

All these issues.. Just adding to this thread to keep it visible. Seems like the lack of any telemetry from functions that fail to deploy is the main problem here. It also does not help that there is a delay between the time the azure portal tells you your function has been deployed to when its actually available for calling. We literally have to deploy our stuff line for line to figure out what is erroring and add comments to the code so we can see what we are actually running. Is there anyone from MS looking into this?

@neopsyon
Copy link

Also ran into the issue, would be great to have logging for function compilation, it's not workable without it, makes troubleshooting ultra hard... already lost hours

@dm-chelupati
Copy link

Thanks for opening this issue. We are working on providing visibility into errors that happen when function host starts in AppInsights soon so you will be able to find out what failed and fix the app. We are also working on shifting these errors to deployment time.

@justinoboyle
Copy link

justinoboyle commented Feb 19, 2025

I wanted to share my experience with this issue. I encountered the same error: "No job functions found. Try making your classes and methods public." Despite trying various solutions, nothing seemed to work. Here are the steps I took to resolve this issue:

  1. Access the SSH Web Interface:

    • In the Azure Portal, navigate to your function app page.
    • Go to Development Tools -> SSH on the side menu.
  2. Navigate to the Project Directory:
    cd ~/site/wwwroot

  3. Install Azure Functions Package:
    apt-get install azure-functions-core-tools-4

  4. Start the Project Using the Local Environment Command:
    func host start

After doing all that, I got the following error:

Exception: SyntaxError: f-string: unmatched '[' (file.py, line 83)

Offending Line of Code:

text += f"{node["value"]}"
The issue arises because Azure function app servers use Python 3.11, where f-strings with double quotes inside double quotes are not allowed. This kind of syntax is fixed in Python 3.13.

I hope this helps others facing the same problem. Why was this error not logged in the application's logs? It would have saved me countless hours of debugging.

After hours of banging my head against a wall with no logs, I just want to thank you. This actually output a log with a useful error (needed to give the function app permission to a Key Vault)

Why is stderr here not logged in the traces?

@inkeliz
Copy link

inkeliz commented Feb 22, 2025

It's impossible to fix the issue without proper log. The Azure support states that such logs are "internal". So, it's easier to debug a microcontroller than a Azure Functions. The support gives the log, but it's a hit or miss, in my case the issue is related to "requests" dependency, but I can't fix that nor I know if that is the only issue.

Well, the Microsoft quality standard: poor documentation, poor software design and terrible service.

Luckily, I need to use it for just couple of months: then I'll move everything to a bare-metal (cheaper, faster and easier).

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

No branches or pull requests