Share via

Azure Exercise - Write data with output bindings Issue

Andrei Witek 26 Reputation points
2021-06-09T16:54:10.27+00:00

Hi guys

While trying to finish this exercise https://learn.microsoft.com/en-us/learn/modules/chain-azure-functions-data-using-bindings/7-write-data-with-output-bindings-portal-lab?pivots=javascript I came across the following issue:

As you see, for the below example, it says Bookmark Added:

103962-one.png

However, for this example it should have said "Bookmark already exists." considering an earlier page of this chapter https://learn.microsoft.com/en-us/learn/modules/chain-azure-functions-data-using-bindings/5-read-data-with-input-bindings-portal-lab?pivots=javascript where we already added that entry to the CosmosDB collection.

Also, when I tried to replicate this in the box I got the same message, suggesting that the input binding couldn't be reached. Considering this, I followed this suggestion https://learn.microsoft.com/en-us/answers/questions/373155/silent-failure-of-azure-function-cosmosdb-input-bi.html , and i tried adding the brackets on the id and partitionKey fields, however the function.json files was overwritten(basically a rollback) while testing the function, hence leading me to the same "Bookmark Added" message

Could you assist?

Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.

Azure Cosmos DB
Azure Cosmos DB

An Azure NoSQL database service for app development.

0 comments No comments

Answer accepted by question author

ChaitanyaNaykodi-MSFT 27,671 Reputation points Microsoft Employee Moderator
2021-06-12T01:03:44.883+00:00

Hello @Andrei Witek , apologies for the delayed response here.

To get rid of the issue I think you will have to delete the HttpTrigger3 Function and recreate it. To delete you can go to the Functions Tab select the function and delete it.
104937-image.png

When you recreate the HttpTrigger3 Function by following the steps here for Azure Cosmos DB input binding in step 9 please add Document ID setting as {id} and for Partition key {id} as well. Same for Azure Cosmos DB output binding please add Partition key as {id}

I have requested you to recreate function app because updating the function.json via portal does not reflect the correct value sometimes as it is not a recommended way. You can go through this Azure Functions binding expression patterns doc to understand more about why id parameter is passed in curly braces.

I have reached out to the team internally to rectify the exercise document and include the suggested changes above.

Please let me know if there are any concerns. Thank you!

Was 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.