Azure / Azure-Functions

1.11k stars 195 forks source link

Warning that Microsoft.Azure.WebJobs.Extensions.ApplicationInsights is being used but it is not (explicitely?) used #2173

Open tymtam2 opened 2 years ago

tymtam2 commented 2 years ago

I am chasing why a function that normally works starts reporting 404 after some period of time and I am looking through Availability and Performance at portal.azure.com and the mighty Functions that are not triggering detector.

The detector reporting an issue I cannot act upon.

It says

Exception Type | Total Occurrences | Exception Message | Latest Timestamp -- | -- | -- | -- The Application Insights extension is no longer supported. Packa | 1 | The Application Insights extension is no longer supported. Package references to Microsoft.Azure.WebJobs.Extensions.ApplicationInsights can be removed. | 2/28/2022 12:53:00 AM

image

However I don't reference this package. Referenced packages are:

  <ItemGroup>
    <PackageReference Include="Azure.Messaging.EventHubs" Version="5.6.2" />
    <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
    <PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.0.1" />
    <PackageReference Include="StackExchange.Redis" Version="2.2.88" />
    <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.406">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>

The project is .NET6:

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>
    <Nullable>enable</Nullable>
  </PropertyGroup>

The function project references one project wich in turn references the following packages:

    <ItemGroup>
    <PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
    <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.406">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>
v-bbalaiagar commented 2 years ago

Hi @tymtam2 , Thank you for your feedback! Could you please give us the function invocation id and region to check the cause.

tymtam2 commented 2 years ago

The region is Asutralia East, but I'm not sure I can get invocation id - I don't see this problem in App Insights and it's part of a request so I'm not sure what invocation id would be here.

The function is https://portal.azure.com/#@ouijalitetest.onmicrosoft.com/resource/subscriptions/1e9450c1-bd33-4166-b3ae-5888031de772/resourceGroups/LuceoTest/providers/Microsoft.Web/sites/luceotestingest/troubleshoot and it is reporting the issue now:

image

tymtam2 commented 2 years ago

Extra info: A sibling function app (in DEV environment, not in TEST environment) does NOT report these issue at the moment. I don't know if the DEV version has ever reported this as the detector's time range can only be set to at most 24h.

Possibly relevant changes between the two function apps are:

  1. DEV app (no warning) has the brand new Microsoft.NET.Sdk.Functions 4.1.0

    -<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.0.1" />
    +<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.0" />
  2. DEV app (no warning) has WEBSITE_RUN_FROM_PACKAGE set to "1" TEST app (with warning) does not have WEBSITE_RUN_FROM_PACKAGE set.

I hope this helps.

v-bbalaiagar commented 2 years ago

Hi @pragnagopa / @balag0 , Could you please look into this issue.

pragnagopa commented 2 years ago

@gzuber / @AnatoliB for triage

jikuja commented 2 years ago

I'm getting same exception with linux/python-based function apps.

Looks like it is probably caused by the runtime or extension bundle:

config of mine.

"extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[2.*, 3.0.0)"
  }

Trying updating the extension bundle soon.

Update: extension update fixed the issue.

RohitRanjanMS commented 2 years ago

PR to remove the Microsoft.Azure.WebJobs.Extensions.ApplicationInsights from v2 extension bundle.

https://github.com/Azure/azure-functions-extension-bundles/pull/189

rsullyo commented 2 years ago

I'm running into the same issue:

image

My code does not have the Microsoft.Azure.WebJobs.Extensions.ApplicationInsights NuGet package. I'm very confused about this error.

My function app runs fine locally on my computer, but when deployed to Azure (Linux or Windows), only gives 404 responses. When I query the AppInsights Traces (traces | where severityLevel > 1 | limit 100 | order by timestamp;), the "No job functions found" is found repeatedly. The image above of the "Functions that are not triggering" (in the Diagnose and solve problems blade) is the only thing that provides some insight why the v4 (.NET 6) Function App I'm trying to deploy is having problems.

I would like to see the above PR get some more attention and action.

RohitRanjanMS commented 2 years ago

@rsullyo your issue is not due to ApplicationInsights extensions. Is this a .Net isolated function?

rsullyo commented 2 years ago

My app is not a .NET isolated function app. So far the only thing that helps is to deploy directly to Azure w/ Visual Studio 2022 (instead of using our Azure DevOps Pipelines) and remove the following NuGet packages:

Now that my app is working in Azure (again), I'm slowly re-introducing NuGet packages back into my app to see which one of them is causing this problem? (if any?)

@RohitRanjanMS, why do you say that my issue is not due to ApplicationInsights extensions? The screen shot I provided in my previous post shows that this exception is being thrown. My code does not reference any NuGet packages for Application Insights (or extensions), and I've searched for code for Application Insights, and there isn't anything related to Application Insights.

RohitRanjanMS commented 2 years ago

@rsullyo you can ignore the warning related to ApplicationInsights extension.

snezhinka158 commented 2 years ago

Hi, @RohitRanjanMS! I have .Net isolated function and the same issue. What does it mean?