Result: Failure Exception: ModuleNotFoundError: No module named 'requests', HTTP Trigger of Azure Function with Python 500

Eddynson Vega 147 Reputation points
2022-01-25T17:34:16.26+00:00

Hello community,

I have developed an azure function locally from Visual Studio Code (VSC) that queries an API and that works very well for me locally, but when I deploy the function in Azure and try to run, I get this error 500.

168370-image.png

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,305 questions
0 comments No comments
{count} votes

Accepted answer
  1. MayankBargali-MSFT 68,656 Reputation points
    2022-01-27T07:16:28.217+00:00

    @Anonymous As per the error ModuleNotFoundError: No module named 'requests' looks like you have not installed the module requests.

    To troubleshoot these types of errors you can always refer to this document.

    If you have any requirement where you need to use any other packages that are not predefined in the functions then you need to add the names or names along with versions of the required packages to the requirements.txt file. Please refer to this document for more details

    Your requirement.txt file will be as below per the exception but in case if you are using any other packages then please make sure that you have defined the same.

    azure-functions  
    requests  
    

    For your reference, I will suggest you to review this article which will can help you to monitor azure function. Once you have set it up you can see the above error in application insights. You can also see these exceptions in the storage account that you have configured on your function app.

    Hope the above helps you to resolve the issue. Feel free to get back to me if you need any assistance.

    0 comments No comments

0 additional answers

Sort by: Most helpful