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 20 support #756

Closed
itpropro opened this issue Oct 20, 2023 · 20 comments · Fixed by #869
Closed

Node 20 support #756

itpropro opened this issue Oct 20, 2023 · 20 comments · Fixed by #869

Comments

@itpropro
Copy link

itpropro commented Oct 20, 2023

If the staticwebapp.config.json file contains

  "platform": {
    "apiRuntime": "node:20"
  },

The following error message will appear:

[swa] WARNING: Failed to read staticwebapp.config.json configuration from:
[swa]    /YOURAPP/staticwebapp.config.json
[swa]
[swa] The following error was encountered: must be equal to one of the allowed values dotnet:3.1, dotnet:6.0, dotnet-isolated:6.0, dotnet-isolated:7.0, node:12, node:14, node:16, node:18, python:3.8, python:3.9, python:3.10
[swa] 0: {
[swa] 1:     "platform": {
[swa] 2:         "apiRuntime": "node:20"
[swa] 3:     },
[swa]
[swa] Please fix the above error and try again to load and use the configuration.
[swa] Read more: https://aka.ms/swa/config-schema

Node 20 is the current release since march and will be LTS in 4 days, so swa should support it.

Update: Node 20 is now the LTS version of Node, 18 is only receiving security fixes and 16 is EOL.

@johnnyreilly
Copy link

There is a different issue when running with Node.js 20. The @azure/identity dependency in turn depends upon "@azure/msal-node" "^1.17.3" which triggers the following message on install:

error @azure/msal-node@1.18.0: The engine "node" is incompatible with this module. Expected version "10 || 12 || 14 || 16 || 18". Got "20.8.1"
error Found incompatible module.

@johnnyreilly
Copy link

If you're using yarn you can hack using a newer version of @azure/msal-node that is Node.js v20 compatible using a resolutions entry in your package.json:

  "resolutions": {
    "**/@azure/msal-node": "2.3.0"
  },

However it looks like Node.js 20 isn't generally supported anyway

✖ Found Azure Functions Core Tools v4 which is incompatible with your current Node.js v20.8.1.
✖ See https://aka.ms/functions-node-versions for more information.

@johnnyreilly
Copy link

There's some discussion on this PR around Node.js 20 support - linking in case it becomes useful.

#758 (comment)

collinbarrett added a commit to collinbarrett/FilterLists that referenced this issue Nov 7, 2023
collinbarrett added a commit to collinbarrett/FilterLists that referenced this issue Nov 8, 2023
@jhelmink
Copy link

jhelmink commented Nov 9, 2023

Until Azure Functions support Node.js v20 isn't this a bit moot? They only just released v18 to public preview.

@itpropro
Copy link
Author

itpropro commented Nov 11, 2023

Until Azure Functions support Node.js v20 isn't this a bit moot? They only just released v18 to public preview.

They released the public preview of Node 20 support on September 27th and they stated themselves that it is later than they wished, but the GA process is a little bit tedious and they plan to release into GA the latest March 2024.
But as azure-functions-core-tools and the whole tooling already supports Node 20, it should definitely be supported by static-web-apps-cli and the Static Web Apps Azure Service.
Node 20 is the current LTS and Node 18 is already in maintenance since October and people started to migrate away from it.

@bzbetty
Copy link

bzbetty commented Nov 16, 2023

For those of us that use .NET as our functions backend I'm not sure why we even get this error? Is there a way to disable this check?

aaronpowell added a commit to aaronpowell/swa-emulator that referenced this issue Dec 5, 2023
@aaronpowell
Copy link
Contributor

For those of us that use .NET as our functions backend I'm not sure why we even get this error? Is there a way to disable this check?

The reason that you get this error with .NET Functions is the CLI tool used to start Azure Functions (azure-functions-core-tools) is a node package.

@aaronpowell
Copy link
Contributor

I've opened a PR, #786, which should fix this.

@itpropro
Copy link
Author

itpropro commented Jan 2, 2024

Do you have any updates on node 20 for the CLI or the runtime @aaronpowell ? All our projects are using the current LTS version or Node, which is 20 and SWA is the only tooling that still doesn't support it.

@aaronpowell
Copy link
Contributor

Do you have any updates on node 20 for the CLI or the runtime @aaronpowell ? All our projects are using the current LTS version or Node, which is 20 and SWA is the only tooling that still doesn't support it.

The PR is up for review by the team, that's the extent of what I know

@jcpachkoski
Copy link

I've been trying the same. I have node.js v20.11.0. I was hoping this was fixed by now.
Found Azure Functions Core Tools v4 which is incompatible with your current Node.js v20.11.0.

@josephboyd9
Copy link

Any update on this yet? Azure Functions have now been updated to support Node.js v20, but swa still doesn't allow them to work together.

@avalanchis
Copy link

As a temporary workaround, I was able to edit the installed source on my workstation.

I found the file in this folder:
C:\Users\username\AppData\Roaming\npm\node_modules\@Azure\static-web-apps-cli\dist\core\func-core-tools.js

I edited the file to match the changes in the PR that @aaronpowell posted above: #786

Seems to be working for me.

@chrisred
Copy link

I would like this fixed too. Did as @avalanchis suggested and it works fine.

@donniefitz2
Copy link

Any updates on this?

@redanthrax
Copy link

Still waiting on this.

@bzbetty
Copy link

bzbetty commented May 9, 2024

The PR works fine and can be applied with patch-package. Not ideal but it's an ok work around.

@adrianhall
Copy link
Member

We've recently released v1.1.10 with Node 20 support. Let us know if this doesn't fix your issue.

@tony19
Copy link

tony19 commented Jul 8, 2024

@adrianhall This fails for me in Node 20:

$ npx @azure/static-web-apps-cli deploy
Need to install the following packages:
@azure/static-web-apps-cli@1.1.10
Ok to proceed? (y) 

npm error code EBADENGINE
npm error engine Unsupported engine
npm error engine Not compatible with your version of node/npm: @azure/msal-node@1.18.0
npm error notsup Not compatible with your version of node/npm: @azure/msal-node@1.18.0
npm error notsup Required: {"node":"10 || 12 || 14 || 16 || 18"}
npm error notsup Actual:   {"npm":"10.7.0","node":"v20.14.0"}

npm error A complete log of this run can be found in: /Users/atrinh5/.npm/_logs/2024-07-08T08_34_17_471Z-debug-0.log

@adrianhall
Copy link
Member

Hi @tony19 - I also noticed this, caused by @azure/identity v3.x - I've upgraded the @azure/identity to v4.3.0 and that will be released in the next service release (which will actually be v2.0.0 because of a number of underlying breaking changes, most notably - dropping support for node < v18)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet