0

I have a python azure function app.

It was working fine, until this morning. func start runs fine, but when I run the listed endpoints, it throws this error:

An unhandled host error has occurred.
[2024-09-16T16:15:59.570Z] System.Private.CoreLib: Exception has been 
thrown by the target of an invocation. 
Microsoft.AspNetCore.Authentication.JwtBearer: Could not load file or 
assembly 'System.IdentityModel.Tokens.Jwt, Version=6.35.0.0, 
Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find 
the file specified.

I don't understand this at all. I have no reference to this package, neither am I using dotnet.

All I am using is Azure function core tools.

How do I fix this ?

12
  • that's a .net error - how is your app set up? Commented Sep 16, 2024 at 16:26
  • @DanielA.White I used visual studio code to create function app project using python 3.11 and run it locally using azure function core tools. Commented Sep 16, 2024 at 16:27
  • You are using python function app, and why are you getting dotnet error? Commented Sep 16, 2024 at 16:28
  • @RithwikBojja this is what I don't understand. And out of nowhere it started showing up. Commented Sep 16, 2024 at 16:28
  • Try rebuilding the using pip freeze and then install . stackoverflow.com/a/18966632 Commented Sep 16, 2024 at 16:31

1 Answer 1

0

I Solved this issue with the following steps:

  1. Check number of azure function core tools in your system and uninstall them.
  2. Uninstall dotnet sdk.
  3. Restart system.
  4. Install azure function core tools again.

Error did mention there was a file called System.IdentityModel.Tokens.Jwt, which was not present.

Issue was 2 versions of azure function core tools were installed. Path variable was using one and System.IdentityModel.Tokens.Jwt file in azure function core tools was of the other version.

Going clean slate did the job.

Thank you everyone for your help!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.