static-web-apps-cli icon indicating copy to clipboard operation
static-web-apps-cli copied to clipboard

`swa start` can't find Azure Functions Core Tools

Open justinyoo opened this issue 11 months ago • 11 comments

Before filing this issue, please ensure you're using the latest CLI by running swa --version and comparing to the latest version on npm.

Are you accessing the CLI from the default port :4280 ?

  • [ ] No, I am using a different port number (--port) and accessing the CLI from that port
  • [x] Yes, I am accessing the CLI from port :4280

Make sure you are accessing the URL printed in the console when running swa start!

ℹ️ NOTE: Make sure to enable debug logs when running any swa commands using --verbose=silly

Describe the bug A clear and concise description of what the bug is.

  • I have Blazor WASM app as a front-end, and Azure Functions as a managed backend.
  • When I run swa start locally, it keeps throwing that Azure Functions Core Tools is not installed or not found
  • However, it's indeed installed the latest version of Azure Functions Core Tools.

To Reproduce Steps to reproduce the behavior:

  1. Clone https://github.com/devkimchi/azure-easyauth-sample
  2. Type in command swa start
  3. See error

Expected behavior A clear and concise description of what you expected to happen.

  • It should run without an error.

Screenshots If applicable, add screenshots to help explain your problem.

Image

Desktop (please complete the following information):

  • OS: Windows 11 Enterprise
  • Version: 24H2

Additional context Add any other context about the problem here.

  • swa version: 2.0.2
  • func version: 4.0.6610
  • If I run the function app first with the command, func start, and attach it to the swa start command like swa start --api-devserver-uri http://localhost:7071 it's fine.

justinyoo avatar Jan 03 '25 15:01 justinyoo

I believe this is the same issue as #899 which has PR #900 up already. I will get that change tested to see if that resolves the issue

Timothyw0 avatar Jan 03 '25 15:01 Timothyw0

I have confirmed that PR #900 fixes this issue, I will resolve this issue once that PR has been merged and released

Timothyw0 avatar Jan 03 '25 15:01 Timothyw0

I have confirmed that PR #900 fixes this issue, I will resolve this issue once that PR has been merged and released

#900 has been merged, can we get a status update pls?

nerblock avatar Jan 27 '25 15:01 nerblock

  • If I run the function app first with the command, func start, and attach it to the swa start command like swa start --api-devserver-uri http://localhost:7071 it's fine.

thank you for the workaround, it works perfectly!

nerblock avatar Jan 27 '25 15:01 nerblock

@nerblock We are prepping for the next release and should have it out some time this week. I will update this issue once it is released.

Glad the current workaround mitigates the issue!

Timothyw0 avatar Jan 27 '25 15:01 Timothyw0

@Timothyw0 Great work! I noticed that the release has been created on GitHub, but the NPM package is still stuck at 2.0.2, see https://www.npmjs.com/package/@azure/static-web-apps-cli

rodyvansambeek avatar Feb 10 '25 10:02 rodyvansambeek

Hey @rodyvansambeek thank you for pointing that out, the npm registry should now be updated with 2.0.3

Timothyw0 avatar Feb 10 '25 15:02 Timothyw0

@Timothyw0 Now, I got a different error message like:

Image

I've got swa CLI 2.0.3, func CLI 4.0.6821 and node.js 22.13.0


Update

After installing the latest version of swa CLI 2.0.3, when I first run the command swa start, it downloads the Azure Functions Core Tools under ~/.swa/core-tools/v4. The func CLI under that directory is of the version 4.0.6280.

Image

It seems this mismatch has caused this error. Is there a way to override the func CLI path to the latest one?

justinyoo avatar Feb 12 '25 00:02 justinyoo

@justinyoo Node 22 support has just been merged into the main branch and not yet released. For the time being, can you please try to downgrade to Node 20 and trying again? This is a result of a functions version and Node version mismatch.

The fix PR is: #919

Timothyw0 avatar Feb 12 '25 01:02 Timothyw0

This is unbelievable... you are literally breaking this software with every single update!🤦‍♂️

Also, nobody asked you to install a separate copy of function tools into the user's home dir! Another 700mb of useless junk taking up valuable space on the system drive.

nerblock avatar Feb 12 '25 10:02 nerblock

@nerblock Sorry about the inconvenience of re-downloading function tools for our SWA emulation. We will make a work item to try using the pre-installed function core tools if the system already has the binaries and only installing it in the home dir if necessary.

Timothyw0 avatar Feb 12 '25 14:02 Timothyw0