-
Notifications
You must be signed in to change notification settings - Fork 128
Wrongly reported Node compatibility #791
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
Comments
Any news on this or #756 @thomasgauvin ? |
A bump for this one. |
+1 🙂 |
What is the a workaround to this issue? I cannot seem to run the SWA locally with a c# function api added, although it does work correctly when deployed to Azure. |
Not sure for C#, but for javascript You can build a local node.js app with embedded calls to your 'api' paths & then run your app against localhost:1337. Tedious but works for development until they fix this. Maybe there is a C# equivalent. var host = "127.0.0.1"; var app = express(); app.get('/api/myapi', function routeHandler(req, res) { app.use('/', express.static('./public')); |
Thank you, that gets me going again, as long as I start the SWA and C# Function app separately this is working for me.
|
Would like to confirm that this is still an issue on v1.1.7 even with the changes from #809 New SWA with C# API gives this output:
swa-cli.config.json: {
"$schema": "https://aka.ms/azure/static-web-apps-cli/schema",
"configurations": {
"temp": {
"appLocation": ".",
"apiLocation": "api",
"outputLocation": "dist",
"apiLanguage": "dotnetisolated",
"apiVersion": "8.0",
"appBuildCommand": "npm run build",
"run": "npm run start"
}
}
} It appears that the issue is related to this function: static-web-apps-cli/src/core/func-core-tools.ts Lines 41 to 53 in b9675b3
Which should probably align closely with the versions listed here: https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-node?tabs=javascript%2Cwindows%2Cazure-cli&pivots=nodejs-model-v4#supported-versions That said, do the func core tools actually depend on the nodejs version, or is that only for running node functions? |
Until #818 is released in a new version, here's an ugly workaround that might just be enough for local development: Open function isCoreToolsVersionCompatible(coreToolsVersion, nodeVersion) {
// Runtime support reference: https://docs.microsoft.com/azure/azure-functions/functions-versions?pivots=programming-language-javascript#languages
switch (coreToolsVersion) {
case 4:
- return nodeVersion >= 14 && nodeVersion <= 18;
+ return nodeVersion >= 14 && nodeVersion <= Infinity; Of course, this "fix" will break once |
If using a GitHub CodeSpace you can find the file here /usr/local/share/nvm/versions/node/v20.12.1/lib/node_modules/@azure/static-web-apps-cli/dist/core/func-core-tools.js |
Annoyingly its already fixed in the source see
|
C:\Users{username}\AppData\Roaming\npm\node_modules@azure\static-web-apps-cli\dist\core\func-core-tools.js I have the same issue. I installed the azure tool globally on windows and found this file. I hope this could be helpful for others. |
We recently released 1.1.10, which I believe fixes this problem. If it is still an issue for you, please let us know. |
When running the swa cli, for example with
pnpm dlx @azure/static-web-apps-cli start app/output --api-location app/server
, it outputsThis is not related to the actual compatibility with Node 20, but is at least a wrong statement in the output, as linked docs/learn site clearly states that Node.js v20.x is supported: https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-node?tabs=javascript%2Cwindows%2Cazure-cli&pivots=nodejs-model-v4#supported-versions.
Is there any reason, the current LTS version of Node is not supported, while Node 16, which is eol since September 2023 still is?
The text was updated successfully, but these errors were encountered: