Share via

How to fix Worker was unable to load entry point

Sylva Obah 20 Reputation points
2023-12-29T14:52:22.83+00:00

i am setting up an azure app, but when i run 'npm run start' i get this error "Worker was unable to load entry point "src/functions/getChatGPTSuggestion.js": Configuration is not a constructor

[2023-12-29T14:48:59.642Z] 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.).

For detailed output, run func with --verbose flag."

any suggestion and assistance?

Azure App Service
Azure App Service

Azure App Service is a service used to create and deploy scalable, mission-critical web apps.

0 comments No comments

Answer accepted by question author
  1. Ryan Hill 30,336 Reputation points Microsoft Employee Moderator
    2023-12-29T17:26:52.83+00:00

    Hi @Sylva Obah

    If you're using a WebJob though, there isn't an entry point required. The web job will run your js as a script file. So, there isn't a need for npm run start in the app service Configuration blade. However, from what you've provided, it appears you're trying to do is an Azure Function which is a different. For that, refer to Node.js developer reference for Azure Functions | Microsoft Learn. If you're using v3 programming model, you should have a functions.json file in the same folder as getChatGPTSuggestion.js that contains the binding you need, for example, httpTrigger. In your js file, you should have an exported module that accepts the arguments for a httpTrigger which would be context and request.

    functions.json

    {
      "bindings": [
        {
          "type": "httpTrigger",
          "direction": "in",
          "name": "req",
          "authLevel": "anonymous",
          "methods": [
            "get",
            "post"
          ]
        },
        {
          "type": "http",
          "direction": "out",
          "name": "res"
        }
      ]
    }
    

    getChatGPTSuggestion.js

    module.exports = async function (context, request) {
        context.log('Http function was triggered.');
        context.res = { body: 'Hello, world!' };
    };
    
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

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