skip to Main Content

This is so weired. And I am unable to find proper answer. now i dont know if i need to deploy my functions to azure functions app or need to add some keys in host.json or local.settings.json to make it run
here is the picture.
enter image description here
enter image description here

2

Answers


  1. func start is stuck, neither shows any error nor listen to 7071 port. so weired.I am using nodejs

    Can you check your Node.js application code to ensure that the server is being created properly and that it’s listening on the correct port. otherwise function should run on specific port like func start --port 7072 command.

    Run this npm install -g azure-functions-core-tools@latest command for latest version of azure function core tools.

    Ensure that all dependencies required by your application are installed correctly. Run npm install to install any missing dependencies or update existing ones.

    I have created Http trigger function with runtime stack Node.js in visual studio code by using func init and func newcommands.

    function code:

    const { app } = require('@azure/functions');
    
    app.http('httpTrigger', {
        methods: ['GET', 'POST'],
        authLevel: 'anonymous',
        handler: async (request, context) => {
            context.log(`Http function processed request for url "${request.url}"`);
    
            const name = request.query.get('name') || await request.text() || 'world';
    
            return { body: `Hello, ${name}!` };
        }
    });
    

    host.json:

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

    The function executed successfully. check below:

    enter image description here

    check below steps to deploy the function into azure portal.
    enter image description here
    after selecting the folder and subscription plan and function app should clicked on deploy button like below:
    enter image description here

    enter image description here
    The function deployed successfully and visible in portal like below:

    enter image description here
    Output:

    enter image description here

    Login or Signup to reply.
  2. In some use cases, this might happen if the function app is trying to connect to a storage account but cannot do this.
    To solve this, you have 2 options:

    1. Use Azurite to simulate local storage. If you’re using VS Code, the extension works really great!
    2. Connect to an actual storage account that is hosted on Azure. To do that, just set the connection string in the local.settings.json file with the key AzureWebJobsStorage.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search