An Azure service that provides an event-driven serverless compute platform.
Hello @Nayak, Rajesh
Based on the provided information, it seems that the issue is with the main function in the WrapperFuntion--> init.py file. The function is not returning a valid HTTP response object.
Here are a few things you can try to resolve the issue:
- Make sure that the
functionNamevariable is defined before it is used in themainfunction. You can define it as a string literal or import it from a module. - Wrap the response body in a
bytesobject before returning it in theHttpResponseobject. For example, you can modify the return statement as follows:
return func.HttpResponse(body.encode(), status_code=status_code, headers=headers)
- Make sure that the Flask app is running on the correct port. By default, Azure Functions expects the app to be running on port 80. You can modify the Flask app to listen on port 80 by adding the following line of code:
flask-app.run(host='0.0.0.0', port=80) - Alternatively, you can modify the Dockerfile to expose port 8080 instead of port 80 by changing the
EXPOSEdirective as follows:EXPOSE 8080Then, you can modify themainfunction to return an HTTP response with status code 200 and a message indicating that the app is running.
For example:
return func.HttpResponse("Flask app is running on port 8080", status_code=200)
I hope that this response has addressed your query and helped you overcome your challenges. If so, please mark this response as Answered. This will not only acknowledge our efforts, but also assist other community members who may be looking for similar solutions.