1

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.

technogeek1995
  • 3,185
  • 2
  • 31
  • 52

1 Answers1

3

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

  • I see in the new Azure Function experience in the Azure Portal, there is a "reset" button. This will accomplish a full reset, right? – Rob Reagan Mar 26 '20 at 14:25