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

evisha 0 Reputation points
2023-12-27T08:28:39+00:00

I am receiving the following error message:

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

These are my setups. I have tried every possible solution. I could not figure out the main cause of the above-mentioned issue.

Environment:

  • Azure Functions Version: 3

Dependencies

{
  "name": "scrape",
  "version": "1.0.0",
  "description": "",
  "type": "module",
  "scripts": {
    "start": "func start --experimental-modules --language javascript",
    "test": "echo \"No tests yet...\""
  },
  "dependencies": {
    "@azure/functions": "^4.0.0",
    "@azure/storage-blob": "^12.17.0",
    "playwright": "^1.40.1"
  },
  "devDependencies": {},
  "main": "src/functions/*.cjs"
}

Configuration Settings

function.json

{
  "scriptFile": "scrapedata.cjs",
  "entryPoint": "main",
  "bindings": [
    {
      "authLevel": "anonymous",
      "type": "httpTrigger",
      "direction": "in",
      "name": "req",
      "methods": ["get", "post"]
    },
    {
      "type": "http",
      "direction": "out",
      "name": "res"
    },
    {
      "name": "outputBlob",
      "type": "blob",
      "path": "outputBlob/{rand-guid}",
      "connection": "AzureWebJobsStorage",
      "direction": "out"
    }
  ]
}

host.js

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

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,936 questions
{count} votes

2 answers

Sort by: Most helpful
  1. MikeUrnun 9,777 Reputation points Moderator
    2024-01-03T03:31:11.5966667+00:00

    Hello @evisha - Thank you for providing additional info in the comment. You likely have a minor misconfiguration relating to v3 to v4 programming models somewhere in your local project stack. I was able to test your use case (HTTP trigger with Blob output) for v4 programming model without any issues and thought this might help:

    • Here's my src/functions/httpTrigger.js file:
    const { app, output } = require('@azure/functions');
    
    const blobOutput = output.storageBlob({
        connection: "AzureWebJobsStorage",
        path: "subfolder/{DateTime:MM-dd-yyyy H:mm:ss}.json",
      });
    
    async function httpTrigger1(request, context){
        context.log(`Http function processed request for url "${request.url}"`);
    
        const name = request.query.get('name') || await request.text() || 'world';
    
        context.extraOutputs.set(blobOutput, 'here goes blob content');
    
        return { body: `Hello, ${name}!` };
    };
    
    app.http('httpTrigger1', {
        methods: ['GET', 'POST'],
        extraOutputs: [blobOutput],
        authLevel: 'anonymous',
        handler: httpTrigger1
    });
    
    • Here's the package.json file (unchanged):
    {
      "name": "nodejs-functionapp-v4",
      "version": "1.0.0",
      "description": "",
      "scripts": {
        "start": "func start",
        "test": "echo \"No tests yet...\""
      },
      "dependencies": {
        "@azure/functions": "^4.0.0"
      },
      "devDependencies": {},
      "main": "src/functions/*.js"
    }
    
    
    • Resulting files created in Blob container:

    User's image

    I hope the above helps & gets you unblocked. If you still hit the same issue, or have any follow-up questions, let me know in the comments below.


    Please "Accept Answer" if the answer is helpful so that others in the community may benefit from your experience.

    1 person found this answer helpful.

  2. Mercado, Marcos 0 Reputation points
    2024-06-14T21:10:15.5433333+00:00

    I was following this guide step by step, and kept getting this same error. After looking at the error trace, it looked like a key value/attribute name was not being recognized. All I did was change Anonymous to ANONYMOUS in my function_app.py file and it worked! Here are the first 10 lines of function_app.py:

    import azure.functions as func
    import datetime
    import json
    import logging
    app = func.FunctionApp()
    @app.route(route="HttpExample", auth_level=func.AuthLevel.ANONYMOUS)
    def HttpExample(req: func.HttpRequest) -> func.HttpResponse:
        logging.info('Python HTTP trigger function processed a request.')
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.