Search code examples
javascriptazureazure-devopsazure-functionsazure-iot-hub

Azure Portal Function Error: Update your NuGet package reference for Microsoft.Azure.WebJobs.Extensions.EventHubs


I've been trying to fix this since yesterday but have done more damage than good. I have a function app (written in JS) in the Azure Portal. All was working well until two days ago when I received the below error. I've seen a few bits online saying the fix is to update the reference however I'm not really sure where I should update the reference to NuGet package. In my function app's code I have both a js file and the json file but I don't know where the NuGet package comes in. Apologies if this is trivial I'm still learning but would really like to understand what's going on here. For reference I'm on a Mac and have been working off VS code.

Microsoft.Azure.WebJobs.Script: One or more loaded extensions do not meet the minimum requirements. For more information see https://aka.ms/func-min-extension-versions.

ExtensionStartupType EventHubsWebJobsStartup from assembly 'Microsoft.Azure.WebJobs.EventHubs, Version=4.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not meet the required minimum version of 4.3.0.0. Update your NuGet package reference for Microsoft.Azure.WebJobs.Extensions.EventHubs to 4.3.0 or later.


Solution

  • Few of the workaround to update the NuGet Packages were:

    Way 1: Using NuGet Package Manager

    Right Click on your project in Visual Studio > Select Manage NuGet Packages Option > Click on Updates > You'll find the Packages if any new versions are available for Update. enter image description here

    Way 2: Using Command Line/Terminal If you're using Visual Studio IDE, to open the terminal:

    enter image description here

    Using this NuGet Official Site , you can find the command here to install from the NuGet Package Manager Console:

    Install-Package Microsoft.Azure.WebJobs.Extensions.EventHubs -Version 5.0.0
    

    If you're using Visual Studio Code IDE, then open the terminal and install/update the required packages using this command and this command will be available in the above site only:

    enter image description here

    The Command is:

    dotnet add package Microsoft.Azure.WebJobs.Extensions.EventHubs --version 5.0.0
    

    Way 3:

    Open the Command Prompt > drive to your project path located > Use the above .Net Core CLI Command to install the required packages like:

    enter image description here

    Way 4:

    Go to NuGet Official Site > Find the latest version of the required package > Copy the Package Reference code and replace the existing old version package reference code from the .csproj file:

    enter image description here

    Double-click the Project Name (1) in the solution explorer to open .csproj file and include the latest package reference of the required package like below:

    enter image description here

    Note:

    1. To download the specific version of the required packages, go to the versions option available on the same official site of the package like below:

    enter image description here

    1. If it specifically asks for updating the extension bundles, then you can refer to this Extension Bundle Site to include the given code in the Host.json file of your Azure Functions Project.