How to fix C# azure function error 404

Nick 0 Reputation points
2024-10-17T11:43:42.6866667+00:00

We are working with Azure b2c and custom policies. For that I created custom policy to signin_sign-up with Apple like the description here:
'https://learn.microsoft.com/en-us/azure/active-directory-b2c/identity-provider-apple-id?pivots=b2c-custom-policy'

The part with the custom policies looks fine, but to generate sign-in/sign-ip with the client secret into a JWT token is's now working without azure function. For that reason was necessary create azure function with C#. Here is the link for more references:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-function-app-portal?pivots=programming-language-csharp.

I looked github page to references with the function and the azure for sign_in with Apple too: https://github.com/azure-ad-b2c/samples/tree/master/policies/sign-in-with-apple

For now I deployed the funcions and them looks fine, but I'm getting error 404 when I test the application with test/run button. The same is happening when I use postman to make the same checks.

Details about the problem:

  1. I'm using dotnet-isolate and when I enter to the function I'm getting this error: 'The 'FUNCTIONS_WORKER_RUNTIME' is set to 'dotnet-isolated', which does not match the worker runtime metadata found in the deployed function app artifacts. The deployed artifacts are for 'CSharp'. See https://aka.ms/functions-invalid-worker-runtime for more information. The application will continue to run, but may throw an exception in the future.'
  2. If I check the "Get functions URL" button it's looking fine. The URL's are generated fine.
  3. If I "test/run" the function I'm getting 404 error code. The same is happening if I use postman. I'm using POST request method for the function.

**The importance here is why im getting error 404? How to solve it?
I need to solve and try to generate the token for apple to make the custom policy sign-ip sign-in works.

I appreciate your help.

Best regards,
Nick**

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Pinaki Ghatak 5,600 Reputation points Microsoft Employee Volunteer Moderator
    2024-10-18T09:04:39.36+00:00

    Hello @Nick

    The error message you are seeing indicates that the worker runtime metadata found in the deployed function app artifacts does not match the FUNCTIONS_WORKER_RUNTIME environment variable that is set to dotnet-isolated. This can cause issues with the function app and may result in exceptions in the future. To solve this issue, you can try setting the FUNCTIONS_WORKER_RUNTIME environment variable to CSharp instead of dotnet-isolated. This should match the worker runtime metadata found in the deployed function app artifacts and resolve the issue. Regarding the 404 error you are seeing, it could be caused by a number of factors. One possibility is that the function URL you are using is incorrect or the function is not deployed correctly. You can try checking the function URL and make sure it is correct. You can also try redeploying the function and see if that resolves the issue.

    If the issue persists, you can try enabling logging for your function app and check the logs to see if there are any errors or exceptions that could be causing the issue.

    This should get you started


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.