Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node: Prompt or detect upgrading users from azure-functions-core-tools@2 to azure-functions-core-tools@3 (or other major version) #2985

Closed
kamranayub opened this issue Oct 13, 2021 · 0 comments · Fixed by #3453
Assignees
Labels
Milestone

Comments

@kamranayub
Copy link

kamranayub commented Oct 13, 2021

Been a user of this extension for a long time (thanks!). I recently used it to create some new TypeScript/Node V3 Functions for a new project. When I went to run/debug the Functions app, I noticed it was saying I was running Functions Runtime v2 😮

It turns out, when I installed this extension, v2 was the major version. But now it's V3. Initially, it installed azure-functions-core-tools@2 globally. However, it wasn't detecting that I was trying to run a V3 app yet my azure-functions-core-tools npm global package is outdated/doesn't match. AFAIK for Node apps, there's not an explicit declaration I'm using V3 in the host.json or anything, so in a way that kinda makes sense.

The command Install Or Update Azure Function Core Tools also doesn't appear to prompt me to upgrade. It only detects I'm on v2 currently and just updates to @2 instead of @3.

It took me awhile to understand how this worked. I finally fixed it by installing @3 myself globally 😄

Proposed Solution

In my workflow, the best place this would have been addressed is when I was originally prompted to create a V3 Functions Node App. At that point, it could have checked to see if I was running outdated Core Tools and then initiated the update.

Alternatively, the next best place would be when I tried to run func host start (via Debugger). The functions runtime is set in my .vscode/settings.json:

{
  "azureFunctions.deploySubpath": ".",
  "azureFunctions.postDeployTask": "npm install (functions)",
  "azureFunctions.projectLanguage": "TypeScript",
  "azureFunctions.projectRuntime": "~3",
  "debug.internalConsoleOptions": "neverOpen",
  "azureFunctions.preDeployTask": "npm prune (functions)"
}

Lastly, Install or Update Azure Function Core Tools could perform this check but I only discovered that looking at the Extension Points.

I don't know how this would be addressed if running a V2 app. There is only one globally installed Core Tools npm package (at the moment) so another possible enhancement might be to find a way to detect it and choose the version.

Extension Output

When running Install Or Update Azure Function Core Tools when I was on v2.

9:24:04 PM: Running command: "npm install -g azure-functions-core-tools@2"...
C:\Program Files\nodejs\func -> C:\Program Files\nodejs\node_modules\azure-functions-core-tools\lib\main.js
C:\Program Files\nodejs\azfun -> C:\Program Files\nodejs\node_modules\azure-functions-core-tools\lib\main.js
C:\Program Files\nodejs\azurefunctions -> C:\Program Files\nodejs\node_modules\azure-functions-core-tools\lib\main.js

> azure-functions-core-tools@2.7.3188 postinstall C:\Program Files\nodejs\node_modules\azure-functions-core-tools
> node lib/install.js

attempting to GET "https://functionscdn.azureedge.net/public/2.7.3188/Azure.Functions.Cli.win-x64.2.7.3188.zip"

+ azure-functions-core-tools@2.7.3188
updated 1 package in 28.29s
9:24:34 PM: Finished running command: "npm install -g azure-functions-core-tools@2".
@nturinski nturinski modified the milestones: 1.6.0, 1.7.0 Nov 1, 2021
@alexweininger alexweininger modified the milestones: 1.7.0, 1.8.0 Jun 9, 2022
@nturinski nturinski modified the milestones: 1.8.0, 1.9.0 Sep 21, 2022
@nturinski nturinski modified the milestones: 1.9.0, 1.10.0 Nov 10, 2022
@motm32 motm32 self-assigned this Nov 23, 2022
@microsoft microsoft locked and limited conversation to collaborators Jan 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
4 participants