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
functionName
variable is defined before it is used in themain
function. You can define it as a string literal or import it from a module. - Wrap the response body in a
bytes
object before returning it in theHttpResponse
object. 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
EXPOSE
directive as follows:EXPOSE 8080
Then, you can modify themain
function 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.