microsoft/Oryx

Deployment failure for Next.js app

swarnilnayan opened this issue · 3 comments

Bug Report

  • At what date and time did you most recently experience the problem?
    25 June 2024 11:30 PM IST

  • Where did you experience the problem? E.g. Azure Web Apps, Azure Functions, Azure Container Registry, or offline use.

Using Node version:
v16.20.2

Using Npm version:
8.19.4

Running 'npm install'...

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'next@14.2.4',
npm WARN EBADENGINE required: { node: '>=18.17.0' },
npm WARN EBADENGINE current: { node: 'v16.20.2', npm: '8.19.4' }
npm WARN EBADENGINE }
npm WARN deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead
npm WARN deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported

added 382 packages, and audited 383 packages in 12s

136 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

Running 'npm run build'...

site@0.1.0 build
next build

You are using Node.js 16.20.2. For Next.js, Node.js version >= v18.17.0 is required.

---End of Oryx build logs---
Oryx has failed to build the solution.

For further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/en-us/azure/static-web-apps/
If you believe this behavior is unexpected, please raise a GitHub issue at https://github.com/azure/static-web-apps/issues/
Exiting

Using Node version:
v16.20.2

Using Npm version:
8.19.4

Running 'npm install'...

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'next@14.2.4',
npm WARN EBADENGINE required: { node: '>=18.17.0' },
npm WARN EBADENGINE current: { node: 'v16.20.2', npm: '8.19.4' }
npm WARN EBADENGINE }
npm WARN deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead
npm WARN deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported

added 382 packages, and audited 383 packages in 12s

136 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

Running 'npm run build'...

site@0.1.0 build
next build

You are using Node.js 16.20.2. For Next.js, Node.js version >= v18.17.0 is required.

---End of Oryx build logs---
Oryx has failed to build the solution.

For further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/en-us/azure/static-web-apps/
If you believe this behavior is unexpected, please raise a GitHub issue at https://github.com/azure/static-web-apps/issues/
Exiting

  • What did you expect or want to happen?
    Build job should have been successful

  • How can we reproduce it?

  • Do you have log output? Please include between the backticks:

Using Node version:
v16.20.2

Using Npm version:
8.19.4

Running 'npm install'...

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'next@14.2.4',
npm WARN EBADENGINE   required: { node: '>=18.17.0' },
npm WARN EBADENGINE   current: { node: 'v16.20.2', npm: '8.19.4' }
npm WARN EBADENGINE }
npm WARN deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead
npm WARN deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported

added 382 packages, and audited 383 packages in 12s

136 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Running 'npm run build'...


> site@0.1.0 build
> next build

You are using Node.js 16.20.2. For Next.js, Node.js version >= v18.17.0 is required.


---End of Oryx build logs---
Oryx has failed to build the solution.

For further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/en-us/azure/static-web-apps/
If you believe this behavior is unexpected, please raise a GitHub issue at https://github.com/azure/static-web-apps/issues/
Exiting

{
"name": "site",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@headlessui/react": "^2.0.4",
"@heroicons/react": "^2.1.3",
"dompurify": "^3.1.5",
"next": "14.2.4",
"next-secure-headers": "^2.2.0",
"nextjs-progressbar": "^0.0.16",
"react": "^18",
"react-dom": "^18",
"swiper": "^11.1.4"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "14.2.4",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"typescript": "^5"
},
"engines": {
"node": ">=18.17.0"
}
}
package.json

name: Azure Static Web Apps CI/CD

on:
push:
branches:
- development # Adjust to your branch if necessary
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- development # Adjust to your branch if necessary

jobs:
build_and_deploy_job:
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- name: Checkout code
uses: actions/checkout@v3

  - name: Setup Node.js
    uses: actions/setup-node@v3
    with:
      node-version: '21.2.0'

  - name: Install Azure Static Web Apps CLI
    run: npm install -g @azure/static-web-apps-cli

  - name: Verify Node.js version
    run: node -v  # Verify the Node.js version in the logs

  - name: Install dependencies
    run: npm install

  - name: Build the app
    run: npm run build

  - name: Deploy using SWA CLI
    run: swa deploy ./ --api-location api --output-location .next --env production --no-use-keychain --token ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_WATER_0EE43D610 }}

close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_WATER_0EE43D610 }}
action: 'close'

I'm also experiencing similar issue. No matter what nodejs version I set in the workflow file, i get
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'next@14.2.4',
npm WARN EBADENGINE required: { node: '>=18.17.0' },
npm WARN EBADENGINE current: { node: 'v16.20.2', npm: '8.19.4' }
npm WARN EBADENGINE }

similar to what has already been reported

In your package.json file, add the engines attribute to explicitly tell oryx to use that version.

Something like:

"engines": {
     "node": ">=18.0.0"
   },

see: https://learn.microsoft.com/en-us/azure/static-web-apps/languages-runtimes#front-end

In your package.json file, add the engines attribute to explicitly tell oryx to use that version.

Something like:

"engines": {

     "node": ">=18.0.0"

   },

see: https://learn.microsoft.com/en-us/azure/static-web-apps/languages-runtimes#front-end

Thanks. Let me get this sorted and I will update the YAML file here for you to take a look.