Open DarraghOFlaherty opened 8 months ago
Having the same issue. With latest nuxt won't build anymore.
Edit
Engines in package.json solved my issue.
Hi folks, have you tried to configure your build-time node version using the configuration of engines in your package.json file? https://learn.microsoft.com/en-us/azure/static-web-apps/languages-runtimes#front-end
Here's a sample repo I created to verify that this is still working https://github.com/thomasgauvin/sample-nuxt-on-swa/blob/5d7ebcc9adca947a34c8669cfba53b58a348da1e/package.json#L17, as you can see in the logs of the GH Actions, it is using Node 20 to build the project https://github.com/thomasgauvin/sample-nuxt-on-swa/actions/runs/7504588916/job/20431981305#step:4:122
Hi all, having the same issue here. @thomasgauvin, referencing your build log, a few lines below we can see node 16.20 being used. https://github.com/thomasgauvin/sample-nuxt-on-swa/actions/runs/7504588916/job/20431981305#step:4:307
This issue mentions specifically the build is causing issues and requires Node 18, this line refers to the Node version of the Functions. Is this also a blocker for you?
Do you have more details about what type of project is being built? Some frameworks override the settings specified in the package.json (like is the case for my Nuxt app), but 'vanilla' managed Azure Functions use the apiRuntime set in the staticwebapp.config.json file https://github.com/thomasgauvin/swa-html-managed-function/actions/runs/7531819984/job/20501195071#step:4:158
For the frameworks that override the staticwebapp.config.json settings, you should be able to skip the API build since your framework will do that for you (no need for separate API build), as you can see here: https://github.com/thomasgauvin/sample-nuxt-on-swa/actions/runs/7531870647/job/20501365824#step:4:34, with this change https://github.com/thomasgauvin/sample-nuxt-on-swa/blob/main/.github/workflows/azure-static-web-apps-white-sky-0d9dbde0f.yml#L34
@thomasgauvin I'm building with nuxt 3
@DarraghOFlaherty does skipping the API build and letting the Nuxt framework fix your issue as I alluded to above?
@thomasgauvin It looks like your function runtime is node 16 https://github.com/thomasgauvin/sample-nuxt-on-swa/actions/runs/7531870647/job/20501365824#step:4:282? I believe this is the node version used when running the server routes which is causing my issue.
@thomasgauvin Following up on this, I forked your example and added my own azure deployment with the skip_api_build
enabled. I created a route that return the process which is using node 16.
Project => https://github.com/DarraghOFlaherty/sample-nuxt-on-swa API Route => https://wonderful-water-07407fc03.4.azurestaticapps.net/test
So looks like setting node:18 for API run time will build the project with node 18 but when the project is run it uses node 16. I'm sure this is a bug.
Thanks @DarraghOFlaherty for the research, let me look more into this
@DarraghOFlaherty, when Nuxt does its build step, it overwrites the staticwebapp.config.json. To have custom overrides of the default Nuxt-generated staticwebapp.config.json, you need to use the option for custom configuration as noted here: https://nuxt.com/deploy/azure#custom-configuration
I recreated to repro here, working correctly with Node 18 now: https://github.com/thomasgauvin/sample-nuxt-on-swa/actions/runs/7574739283, https://white-sky-0d9dbde0f.4.azurestaticapps.net/test
I submitted a PR for the nuxt.com docs to make this clearer: https://github.com/nuxt/nuxt.com/pull/1483
Describe the bug
A clear and concise description of what the bug is.
To Reproduce Create azure static web app and update to staticwebapp.config.json to use node 18
Expected behavior Trying to use node 18 in Azure static web app. Selected node 18 package.json engines and in config file. App is built using node 16 causing problems as I have a dependency on node 18
Screenshots Specified node 18 in staticwebapp.config.json
Specified node 18 in package.json
Specified node 18 in ci.yaml
Oryx is using node 16
Device info (if applicable):
Additional context Add any other context about the problem here.