Azure Function function.json file is missing - azure

I published my Azure Function, it run as expected. Then I updated the code a bit without changing any configurational value. Now my function.json file is missing in Azure and my function is not running...
I published with new profile. I was expecting to see function.json file.

Glad #FurkanKaracan, that you have resolved the issue by restarting the IDE and redeploying it.
Function.json file missing issue will be caused if the function project is deployed with Runtime Issues.
That file is generated by the Function SDK in .csproj file Microsoft.NET.Sdk.Functions NuGet Package.
Any Changes to this file configuration code bindings are not allowed.
I have checked the following test cases to make the function.json file missing in the Code+Test menu:
Disabled the Function and redeployed from local IDE.
Published Several times by making function code changes through IDEs and CLI Commands.
Checked the Kudu Site of my Function App for every publish/deploy.
That file was visible perfectly how many times I redeploy the project to function app in the Azure Portal.
As per my experience, it might be some deployment issues while publishing.
Refer to this MS Doc for more info on function.json file.

Restarting visual studio and redeploying the app fixed the issue. I really hate microsoft's technologies...

Related

New deployed azure function returns 404 Not Found error

Hey I have deployed new azure function using Azure dev ops CI/CD. The function app has been deployed successfully and when I go to the main URL, it says your function app is running. I tried to test the end points("/save") using azure portal and the output is 404 Not found. The same results when I use POST man as well. Any help would be appreciated?
2020-11-21T11:30:45.769 [Error] The following 2 functions are in error:
Get: The function type name 'DocumentContextFunction.Functions.GetDocument'
is invalid.
Save: The function type name
'DocumentContextFunction.Functions.SaveDocument' is invalid.
I have fixed this by updating the value of the "FUNCTIONS_EXTENSION_VERSION" from 1 to 3. For some reason every time I deployed using Azure CI/CD, its value is set to 1, so I have to manually change it to be 3.
I encountered this error when my build targeted win-x64 whereas the Azure Function Platform was configured as 32 bit.
In my case I had a function created in portal. I then published a function via visual studio. After publishing the portal created function was 404 not found and I could not even delete the function from the portal.
Exact same code in a new function worked as expected.
This is not intuitive and were no indications in the portal that previous portal created functions would break.
This maybe buried somewhere in documentation but I would have expected a warning in azure before allowing other functions to break without code changes.
The author's question helped me understand where the problem was coming from. In my case, it was not about the CI/CD pipeline doing anything funny.
It was my IaC code which was not setting up the function app properly. It picks version ~1 by default but I had to set it to ~3.
My function apps were working until I included a new custom package with a later version of Microsoft.Extensions.Logging. My functions were using Microsoft.Extensions.Logging 2.1.1. The package had version 7.0.0, which is for Net7. It was incompatible with my Net6 projects.
When the package was added, the Microsoft.Extensions.Logging version in my project was updated to 7.0.0. The were no compile errors, but debugging showed that the assembly could not be loaded. This was causing the 404.
Changing the package version back to 2.1.1 corrected the problem.
This is what worked for me...
Note: I was getting 404 on my function which is a nodejs and inline editing on the browser.
Open your function.json and take a backup as we are going to change it.
See if in your function.json there are two different settings with "direction": "in"
For me there were two. I tried deleting but it keep coming back.
Next I went to 'Integrations' (on left menu) and opened my trigger and deleted it. This will recycle your trigger. And hope this works for you too.

Is there a method for hard resetting an Azure function?

I'm looking for a way to perform a hard reset on a NodeJS Azure Function that gets uploaded through VS Code? It's v2 of the Azure Functions.
Things I have tried
restarting the Azure Function via the portal
stopping/starting the Azure Function via the portal
removing the bin, obj, extensions.csproj and node_modules from the VS Code project and re-installing
The reason why I'm looking to do this is that I have updated a local package through npm install --save <my new module>, but it isn't running the latest package when I invoke my Azure Function after uploading with the updated package through VS Code. I have verified that the package was updated by reviewing the package.json file and the source in node_modules (on VS Code and in Kudu on the portal). My hypothesis is that by not changing the Azure Function's source code, the Azure Function doesn't reload with the new package, which seems like it could likely be a bug. I would prefer if I don't have to change the source every time I update the node_modules, which is why I'm looking for the reset.
Related except for C# - does't seem to make a difference with NodeJS
Any guidance is appreciated.
There're few things to try out here:
Please go to the Kudu website of your function app (url => https://{your-function-app-name}.scm.azurewebsites.net/) and navigate from "Debug console" menu >CMD/PowerShell, and:
Please check folder site>wwwroot>node_modules and make sure than expected module version is present there
If not then please make sure that the package-lock.json is pinning to a specific version of a module, and also please make sure that modules and their version in package.json and package-lock.json are as expected
Also, to reset the function app, you can add a test app settings {"testKey", "testValue"} which will cause your app to restart and pick up the new modules, and once the function picks up the new module then you can clean up this test app settings

Error WAT200: No default service configuration "ServiceConfiguration.cscfg" could be found in the project

After installing Visual Studio Enterprise 2017 (Version 15.1 (26403.7)) my Azure Cloud Service does no longer build and gives me the 'Error WAT200: No default service configuration "ServiceConfiguration.cscfg" could be found in the project'. Although it still works fine with Visual Studio Enterprise 2015. (The right TargetProfile is also specified...)
I ran into this last night.
It actually happens when you rename Cloud Service configurations away from Cloud and Local.
In my case, I had deleted the Cloud configuration and created a new, differently named one.
By ensuring that the configurations are called Cloud and Local, the Cloud Service projects will build again using "Resharper build", and (most likely) under "Lightweight solution load".
The configurations can be renamed by right-clicking one of the service roles under the Cloud Service node in Solution Explorer, choosing Properties, then opening up the "Service Configuration" dropdown and clicking <Manage...>.
Now, in the resulting dialog, the configurations can be renamed:
The following bug report got me on the right track:
https://youtrack.jetbrains.com/issue/RSRP-450390
The best way is to change the service configuration prefix in ccproj of your project, add yourprojectname.configurationname
Dot is the life saver.
<ServiceConfigurationPrefix>yourproject.ServiceConfiguration</ServiceConfigurationPrefix>
Add these in itemgroup:
<ServiceDefinition Include="yourproject.ServiceDefinition.csdef" />
<ServiceConfiguration Include="yourproject.ServiceConfiguration.cscfg" />
Make sure you have renamed your cscfg files from the folder it resides.
Reload
Bingo. It works.
Ok I found it, after disabling the 'Lightweight Solution Load' (which in VS 2017 u can disable by right click on the Solution and then Disable Lightweight Solution Load), the error disappears and the Cloud Service builds again.
Similar to Rishikesh mentioned, but I added a service config entry
<ServiceConfiguration Include="ServiceConfiguration.cscfg" />
to the ccproj. Then copied a configuration, e.g. Production and named it ServiceConfiguration.cscfg. Then reloaded the project. That got the ReSharper to build, but MORE importantly for me at the moment was to figure out how to the get Azure DevOps pipeline to build the solution with multiple Classic WebRole projects in it. That was failing for the SAME reason.

Functions published as a VS2015 Web Application not showing up in the portal list

I followed the roadmap to create a set of Azure Functions as a Web Application. They deployed without an issue to my Azure Function App.
I moved the project to a new solution and changed the name spaces and updated the function.json files. When I redeployed to the Function App I was getting a bad entry point on one function which I double checked and tried to update a couple of ways without any success.
Thinking that the Function App might be caching I tried restarting the app and then finally went into the App Service Editor and deleted all the files and republished. Now none of the functions show up in the list even through the directories and function.json files for each function are confirmed present.
Has anyone else experienced something like this or have a suggestion as to how to resolve it?
It looks like your script file in function.json is set to a dll that doesn't exist in bin. Double check the dll name there.
You can see the content of bin folder on azure through debug console by going to https://<yourAppName>.scm.azurewebsites.net/DebugConsole

Azure Functions not using latest binary

I am building a Function App in C# with a compiled library. I deploy the code from the CLI and that's all fine.
Checking the file system with KUDU I can see all the files are updated, the *.dll is updated (the timestamp), but executing the function I get a result from an earlier build.
I execute the function locally from Visual Studio and everything is fine and outputs are as expected.
I can sometimes get the new build used by restarting the site from KUDU, but that's really not desired.
Any idea? I never had these issues when deploying through Github.
Where is your assembly deployed? If deploying the assembly to a folder outside of the actual function folder, please add that to the watchDirectories configuration in your host.json file.
You can find more information about that setting here.

Resources