skip to Main Content

I’m having real trouble getting some basic Typescript functions deployed to Azure. I deployed using VS code, and the deployment was successful according to the Output window, but when I look at the Function App in the Azure Portal, there are no functions listed:

enter image description here

Also no functions appear in the Azure tab in VS code:

enter image description here

I checked my project structure and it mirrors what is suggested in the Typescript developer guide:

<project_root>/
 | - .vscode/
 | - dist/
 | | - src/
 | | | - functions/
 | | | | - myFirstFunction.js
 | | | | - myFirstFunction.js.map
 | | | | - mySecondFunction.js
 | | | | - mySecondFunction.js.map
 | - node_modules/
 | - src/
 | | - functions/
 | | | - myFirstFunction.ts
 | | | - mySecondFunction.ts
 | - .funcignore
 | - host.json
 | - local.settings.json
 | - package.json
 | - tsconfig.json

I checked that AzureWebJobsFeatureFlags is set to EnableWorkerIndexing, as someone suggested that in a different SO post. The Typescript files are being successfully compiled during deployment and appear in dist > src > functions.

I also tried deploying using the Core Tools. Again, the deployment was successful. It said that the zip package was uploaded, but no functions appear.

What am I missing here?

2

Answers


  1. You are missing the function.json file for your functions.

    Should look something like this.

     {
      "disabled": true,
      "scriptFile": "test.js",
      "bindings": [
        {
          "type": "timerTrigger",
          "direction": "in",
          "schedule": "0 0 */5 * * *"
        }
      ]
    }
    
    Login or Signup to reply.
  2. I agree with @Gagan Bajwa. Every function has an individual function. Json.
    I created HTTP trigger functions with two function in typescript runtime stack.

    Function1 host.json:

    {
      "bindings": [
        {
          "authLevel": "function",
          "type": "httpTrigger",
          "direction": "in",
          "name": "req",
          "methods": [
            "get",
            "post"
          ]
        },
        {
          "type": "http",
          "direction": "out",
          "name": "res"
        }
      ],
      "scriptFile": "../dist/src/HttpTrigger1/index.js"
    }
    

    Function2 host.json:

    {
      "bindings": [
        {
          "authLevel": "anonymous",
          "type": "httpTrigger",
          "direction": "in",
          "name": "req",
          "methods": [
            "get",
            "post"
          ]
        },
        {
          "type": "http",
          "direction": "out",
          "name": "res"
        }
      ],
      "scriptFile": "../dist/HttpTrigger2/index.js"
    }
    
    • I have given the scriptFile path in the function. Json.

    Below is the folder structure and the status of running my code:

    enter image description here

    deployment status:

    enter image description here

    Output:
    I am able to see the functions in the Azure portal where I was deployed.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search