Keep getting invalid body error for function App for exercise "Enrich a search index in Azure AI Search with custom classes"

Cindy Paola Martinez 20 Reputation points
2024-08-07T16:56:41.59+00:00

Keep getting Invalid body error from function app :

def main(req: func.HttpRequest) -> func.HttpResponse:
    logging.info('Python HTTP trigger function processed a request.')

    try:
        body = json.dumps(req.get_json())
    except ValueError:
        return func.HttpResponse(
             "Invalid body",
             status_code=400
        )


When I update my skillset, index and indexer the indexer fails and show this error:

Could not execute skill because Web Api skill response is invalid.

I am using Python 3.8. Please advise, I already verified every step of the process, but I think the problem is in the function init.py code

This question is related to the following Learning Module

Azure Training
Azure Training
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Training: Instruction to develop new skills.
2,257 questions
{count} votes

Accepted answer
  1. Pradeep M 6,655 Reputation points Microsoft External Staff
    2024-08-08T06:11:43.36+00:00

    Hi Cindy Paola Martinez,

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.

    Issue: Keep getting invalid body error for function App for exercise "Enrich a search index in Azure AI Search with custom classes"

    Solution: The issue was related to the init.py script in the function. Increasing the timeout duration resolved the problem.

    If you have any other questions or are still running into more issues, please let me know.

    Thank you again for your time and patience throughout this issue.

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

    Thank you. 

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