Unable to add function binding--vscode workspace local project is not showing my-function

hamza ali 40 Reputation points
2024-03-23T08:42:20.7433333+00:00

User's image

Hello everyone,
I am developing azure function(javascript) locally on VSCODE. The azure vscode extension show us our function name under workspace-->localproject-->function-->our-function-name and from there we could add binding to input/output to anywhere(i-e cosmos db). but I am only seeing start debugging instead of my function name.
How i will be able to add bindings now?

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

2 answers

Sort by: Most helpful
  1. Ryan Hill 29,291 Reputation points Microsoft Employee
    2024-03-23T20:02:05.3833333+00:00

    Hi @hamza ali

    It looks like you just created a function project without any functions in it. To add the function with the binding, you can click the Azure Function icon and select Create New Function from the context menu.

    User's image

    This will bring up a wizard that will step you through creating a trigger function. Or, you could add the function yourself by creating the method and decorating that method with app.cosmosdb_trigger attribute:

    @app.cosmos_db_trigger(name="documents", 
                           connection="CONNECTION_SETTING",
                           database_name="DB_NAME", 
                           container_name="CONTAINER_NAME", 
                           lease_container_name="leases",
                           create_lease_container_if_not_exists="true")
    def test_function(documents: func.DocumentList) -> str:
        if documents:
            logging.info('Document id: %s', documents[0]['id'])
    

    See Develop Azure Functions locally using Core Tools | Microsoft Learn for more details.


  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

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.