How to create http_trigger alone in the existing function app, but not the whole function from scratch?

SangeethaP 40 Reputation points
2023-10-05T07:15:55.92+00:00

I have created a function app in Azure. Using Visual Studio Code, I created a function in local, and deployed it to existing function app.

The first time I deployed, it was successful.

The second time, however, when I deployed the same function from local to the same existing function app, the http_trigger inside the function app disappeared.

After that, I tried the deployment multiple times, but still the http_trigger is not found.

Why did it get removed on the second deployment? Should I deploy the function only once?

If yes, is there any way to perform the deployment again, in case of any changes in the code inside the function?

I have the script file test_run.py with some code, inside the function in the function_app.py file, I tried to import my script file like below, after making these changes, I tried for deployment when the http_trigger got removed.

function_app.py:

import test_run

"""rest of the default trigger function code"""

if name:
	test_run.main()
	return f"Hello {name}. The function triggered"
else:
	test_run.main()
	return f"Hello. The function triggered without a name"

test_run.py:

def func_1():
   function code
def func_2():
   function code
def func_3():
   function code
def main ():
   try:
       func_1()
       func_2()
       func_3()
   except:
       code for retry

I was also not able to create only the http_trigger inside the function, that option is not available for me in either vs code or in Azure Portal. Also, if I create the new function and function app from scratch, it was deployed the first time successfully. When I do some changes in the script and try to deploy it again, the http_trigger got removed. Please help me to resolve this.

Note: this function will be used in the Azure Data Factory pipeline. That's why used Azure Data Factory tag as well.

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

Accepted answer
  1. navba-MSFT 27,500 Reputation points Microsoft Employee
    2023-10-06T10:07:30.94+00:00

    @SangeethaP Welcome to Microsoft Q&A Forum, Thank you for posting your query here!

    I understand that you are facing an issue while deploying your HTTP Triggered function app with the http trigger missing during second deployment.

    • Please confirm if you used the az functionapp deployment source config-zip CLI command to perform the deployment. More info about the Zip deployment through CLI. Did you try with most recent CLI version (2.53.0) ?
    • Did you try restarting the function app and check if that makes a difference ?
    • Could you please make sure that the d:\home\data\SitePackages (Windows) or /home/data/SitePackages (Linux) folder has a file named packagename.txt ?This file contains only the name, without any whitespace, of the package file in this folder that's currently running.
    • Open the d:\home\site\wwwroot (Windows) or /home/site/wwwroot and then navigate to your function app folder and check if your updated code is present here. This step is to isolate that you deployment is done successfully.
    • Could you please perform the deployment as mentioned in this document and check if that helps ? If you have tried it already try publishing with func azure functionapp publish command (see here) and check if that makes a difference.

    If none of the above action plan helps, please let me know I would be happy to assist you further.

    **

    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments

0 additional answers

Sort by: Most helpful

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.