Share via

Azure function return 500 internal server error when using CosmosDB as the input binding

Edward An 0 Reputation points
2024-10-14T08:14:12.5566667+00:00

I am following this exercise for every step and I am getting 500 errors in the response.

The request hasn't even reached the code.

Function.json

{
  "bindings": [
    {
      "authLevel": "function",
      "type": "httpTrigger",
      "direction": "in",
      "name": "req",
      "methods": [
        "get",
        "post"
      ]
    },
    {
      "type": "http",
      "direction": "out",
      "name": "res"
    },
    {
      "name": "inputDocument",
      "direction": "in",
      "type": "cosmosDB",
      "partitionKey": "/id",
      "methods": [],
      "databaseName": "edward",
      "collectionName": "Bookmarks",
      "connectionStringSetting": "wetwertwret_DOCUMENTDB",
      "id": "id"
    }
  ]
}

codeUser's image

This question is related to the following Learning Module

Azure | Azure Training
0 comments No comments

1 answer

Sort by: Most helpful
  1. AmaranS 7,290 Reputation points Microsoft External Staff
    2024-10-14T10:56:40.07+00:00

    Hi Edward An,

    It seems like the error consistently occurs in your HttpStart function due to an undefined extraInputs property. To troubleshoot:

    1. Review the index.js file of HttpStart for extraInputs references.
    2. Verify correct function parameters passed to getClient.
    3. Check the durable functions library docs for usage changes.
    4. Ensure function bindings handle extraInputs properly.
    5. Add logging to track variable values.
    6. Investigate recent code changes.
    7. Monitor Azure Function logs for additional clues.

    This approach should help pinpoint and resolve the issue. Let me know if you need further assistance!
    If you need more help, feel free to share additional details or code snippets, and I'll do my best to assist you further. I hope the information we provided was helpful to you! If it was, please consider accepting the answer by clicking the Accept Answer/Upvote button. Your feedback is valuable and can assist others with similar questions. Thank you for contributing to improving Microsoft Q&A!

    Thank you.

    Was this answer helpful?

    1 person found this answer 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.