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

Oryx does not support node version 18 #2369

Open
bh3605 opened this issue Mar 4, 2024 · 9 comments
Open

Oryx does not support node version 18 #2369

bh3605 opened this issue Mar 4, 2024 · 9 comments

Comments

@bh3605
Copy link

bh3605 commented Mar 4, 2024

Bug Report

  • At what date and time did you most recently experience the problem?
    2/29/24

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

  • If your repo is publicly available please share its URL:

  • What happened?
    Oryx says it does not support a version of nodejs it does in fact support.

  • What did you expect or want to happen?
    Build succeeded

  • How can we reproduce it?
    build an angular 17 app

  • Do you have log output? Please include between the backticks:
    Starting: Build
    ==============================================================================
    Task : Command line
    Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
    Version : 2.231.1
    Author : Microsoft Corporation
    Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
    ==============================================================================
    ##[warning]The container operating system doesn't support Node20. Using Node16 instead. Please upgrade the operating system of the container to remain compatible with future updates of tasks: https://github.com/nodesource/distributions
    Generating script.
    Script contents:
    oryx build /__w/1/s/ --output /__w/1/a
    ========================== Starting Command Output ===========================
    /bin/bash --noprofile --norc /__w/_temp/ca0f06c8-dc3d-4b96-a2cd-f5f94cc643d8.sh
    Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
    You can report issues at https://github.com/Microsoft/Oryx/issues

Oryx Version: 0.2.20240222.1, Commit: 8b3ac45, ReleaseTagName: 20240222.1

Build Operation ID: 88e13cde3c3cae6b
Repository Commit : 6c7b4684f5790d79f4e5949183f6dbd56444a65f
OS Type : stretch
Image Type : full

Detecting platforms...
Error: Platform 'nodejs' version '>=18.13.0' is unsupported. Supported versions: 10.1.0, 10.10.0, 10.12.0, 10.14.2, 10.16.3, 10.18.0, 10.18.1, 10.19.0, 10.20.0, 10.20.1, 10.21.0, 10.22.0, 10.22.1, 10.23.0, 10.24.1, 12.11.0, 12.11.1, 12.12.0, 12.13.0, 12.14.0, 12.14.1, 12.16.0, 12.16.1, 12.16.2, 12.16.3, 12.18.0, 12.18.1, 12.18.2, 12.18.3, 12.18.4, 12.19.0, 12.20.0, 12.21.0, 12.22.0, 12.22.11, 12.22.12, 12.22.4, 12.22.6, 12.22.9, 12.9.1, 13.9.0, 14.0.0, 14.1.0, 14.10.0, 14.10.1, 14.11.0, 14.12.0, 14.13.0, 14.13.1, 14.14.0, 14.15.0, 14.15.1, 14.16.0, 14.17.0, 14.17.4, 14.17.6, 14.18.3, 14.19.1, 14.2.0, 14.21.3, 14.3.0, 14.4.0, 14.5.0, 14.6.0, 14.7.0, 14.8.0, 14.9.0, 15.0.0, 15.0.1, 15.1.0, 15.2.0, 15.2.1, 15.3.0, 16.13.1, 16.13.2, 16.14.0, 16.14.2, 16.20.0, 16.5.0, 16.6.1, 16.8.0, 17.0.1, 17.1.0, 17.2.0, 17.3.1, 17.4.0, 17.5.0, 17.6.0, 4.4.7, 4.5.0, 4.8.0, 4.8.7, 4.9.0, 4.9.1, 6.10.3, 6.11.0, 6.11.5, 6.17.1, 6.2.2, 6.6.0, 6.9.3, 6.9.5, 8.0.0, 8.1.4, 8.11.2, 8.11.4, 8.12.0, 8.15.1, 8.16.1, 8.16.2, 8.17.0, 8.2.1, 8.8.1, 8.9.4, 9.4.0, 1.17.3, 1.18.0, 1.19.0, 1.19.1, 1.19.2, 1.20.0, 1.21.0, 1.21.1, 1.22.0, 1.22.1, 1.22.2, 1.22.4, 10.1.0, 10.10.0, 10.12.0, 10.14.2, 10.16.3, 10.18.0, 10.18.1, 10.19.0, 10.20.0, 10.20.1, 10.21.0, 10.22.0, 10.22.1, 10.23.0, 10.24.1, 12.11.0, 12.11.1, 12.12.0, 12.13.0, 12.14.0, 12.14.1, 12.16.0, 12.16.1, 12.16.2, 12.16.3, 12.18.0, 12.18.1, 12.18.2, 12.18.3, 12.18.4, 12.19.0, 12.20.0, 12.21.0, 12.22.0, 12.22.11, 12.22.12, 12.22.4, 12.22.6, 12.22.9, 12.9.1, 13.9.0, 14.0.0, 14.1.0, 14.10.0, 14.10.1, 14.11.0, 14.12.0, 14.13.0, 14.13.1, 14.14.0, 14.15.0, 14.15.1, 14.16.0, 14.17.0, 14.17.4, 14.17.6, 14.18.3, 14.19.1, 14.2.0, 14.21.3, 14.3.0, 14.4.0, 14.5.0, 14.6.0, 14.7.0, 14.8.0, 14.9.0, 15.0.0, 15.0.1, 15.1.0, 15.2.0, 15.2.1, 15.3.0, 16.13.1, 16.13.2, 16.14.0, 16.14.2, 16.20.0, 16.5.0, 16.6.1, 16.8.0, 17.0.1, 17.1.0, 17.2.0, 17.3.1, 17.4.0, 17.5.0, 17.6.0, 4.4.7, 4.5.0, 4.8.0, 4.8.7, 4.9.0, 4.9.1, 6.10.3, 6.11.0, 6.11.5, 6.17.1, 6.2.2, 6.6.0, 6.9.3, 6.9.5, 8.0.0, 8.1.4, 8.11.2, 8.11.4, 8.12.0, 8.15.1, 8.16.1, 8.16.2, 8.17.0, 8.2.1, 8.8.1, 8.9.4, 9.4.0, 1.17.3, 1.18.0, 1.19.0, 1.19.1, 1.19.2, 1.20.0, 1.21.0, 1.21.1, 1.22.0, 1.22.1, 1.22.2, 1.22.4
##[error]Bash exited with code '3'.


@chryw
Copy link

chryw commented Mar 5, 2024

Same issue. Even if I specify node version in a previous task, it won't use that version.

For example, this is what I have in my pipeline:

  - stage: Build
    jobs:
      - job: Build
        displayName: Build & deploy
        pool:
          vmImage: 'ubuntu-latest'
        steps:
          - task: NodeTool@0
            inputs:
              versionSource: 'spec'
              versionSpec: '18.x'
              checkLatest: true
            displayName: 'Install Node.js'
          - task: AzureStaticWebApp@0
            inputs:
              azure_static_web_apps_api_token: $(AZURE_STATIC_WEB_APPS_TOKEN)
              app_location: "/" # App source code path
              output_location: "out" # Built app content directory - optional
              is_static_export: true # For running Static Next.js file - optional

This is the error log:

Using Node version:
v16.20.2

Using Npm version:
8.19.4

Running 'npm install'...

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '>=18.17.0' },
npm WARN EBADENGINE   current: { node: 'v16.20.2', npm: '8.19.4' }
npm WARN EBADENGINE }
npm ERR! code E401
npm ERR! Unable to authenticate, your authentication token seems to be invalid.
npm ERR! To correct this please trying logging in again with:
npm ERR!     npm login

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2024-03-05T23_26_52_898Z-debug-0.log


@chryw
Copy link

chryw commented Mar 5, 2024

Specifying node version in package.json worked according to #2367 comment
However, this task doesn't support private npm feed authentication 🥹 still pretty limited. Any alternative ways to deploy to Azure static web app?

@chryw
Copy link

chryw commented Mar 6, 2024

PS: I just found this note about specifying node version in package.json. It's a bit hidden:

Note: Currently, you can only define app_build_command and api_build_command for Node.js builds. To specify the Node.js version, use the engines field in the package.json file.

https://learn.microsoft.com/en-us/azure/static-web-apps/build-configuration?tabs=azure-devops#custom-build-commands

@bh3605
Copy link
Author

bh3605 commented Mar 6, 2024

Neither this
"engines": {
"node": ">=18.13.0"
},
nor this worked
"engines": {
"node": "18.19.1"
},

@bh3605
Copy link
Author

bh3605 commented Mar 6, 2024

@chryw To answer your private npm feed problem, what I've done is uploaded a .npmrc file to secure files in Azure Devops and downloaded the file to the build. You could also just add an .npmrc file yourself to your repo and make sure you have always-auth set to false. Here's the whole job template minus the input params. It can handle building an azure static web app too.

jobs:
- job: 
  displayName: Build Application
  container: 'mcr.microsoft.com/oryx/build:latest'
  variables: 
    - name: buildPath
      value: $(Build.SourcesDirectory)/${{parameters.projectDirectory}}
  steps:
    - checkout: self
    - task: DownloadSecureFile@1
      displayName: Download private .npmrc file
      name: npmrc
      inputs:
        secureFile: 'private.npmrc'
    - script: |
        mv $(npmrc.secureFilePath) ${{variables.buildPath}}/.npmrc
      displayName: 'Move secure file to nodejs project dir'
    - script: oryx build ${{variables.buildPath}} --output $(Build.ArtifactStagingDirectory)
      displayName: Build
      env:
        NODE_VERSION: ${{parameters.nodeVersion}}
        NODE_DEFAULT_VERSION: ${{parameters.nodeDefaultVersion}}
        DISABLE_NODEJS_BUILD: ${{parameters.disableNodeJsBuild}}
        CUSTOM_BUILD_COMMAND: ${{parameters.customBuildCommand}}
        RUN_BUILD_COMMAND: ${{parameters.runBuildCommand}}
        ENABLE_NODE_MONOREPO_BUILD: ${{parameters.enabledNodeMonorepoBuild}}
        COMPRESS_DESTINATION_DIR: ${{parameters.compressDestinationDir}}
        PRUNE_DEV_DEPENDENCIES: ${{parameters.pruneDevDependencies}}
        NPM_REGISTRY_URL: ${{parameters.npmRegistryUrl}}
        YARN_TIMEOUT_CONFIG: ${{parameters.yarnTimeoutConfig}}
    - ${{if eq(parameters.isSWA, true)}}:
      - script: cp $(Build.SourcesDirectory)/staticwebapp.config.json $(Build.ArtifactStagingDirectory)/dist/${{parameters.outputDir}}
        displayName: Copy staticwebapp.config.json to dist/${{parameters.outputDir}}
    - task: PublishPipelineArtifact@1
      inputs:
        targetPath: '$(Build.ArtifactStagingDirectory)/dist'
        artifact: 'drop'
        publishLocation: 'pipeline'

@bh3605
Copy link
Author

bh3605 commented Mar 6, 2024

I figured out you can specify a debian flavor. Using bullseye since that supports node 18. Also specified the node version environment var too. Getting this error now

Starting: Build
==============================================================================
Task         : Command line
Description  : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version      : 2.231.1
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
==============================================================================
##[warning]The container operating system doesn't support Node20. Using Node16 instead. Please upgrade the operating system of the container to remain compatible with future updates of tasks: https://github.com/nodesource/distributions
Generating script.
Script contents:
oryx build /__w/1/s/ --output /__w/1/a
========================== Starting Command Output ===========================
/bin/bash --noprofile --norc /__w/_temp/d04c5994-da8a-40a2-ba0b-ac76d35b0bca.sh
Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
You can report issues at https://github.com/Microsoft/Oryx/issues

Oryx Version: 0.2.20240222.1, Commit: 8b3ac454331efe1b7934439f06cc7ece42c01613, ReleaseTagName: 20240222.1

Build Operation ID: cc0f1764c7c37361
Repository Commit : 137b8a7b5ab1524f292019e9ef6ef975c6af2371
OS Type           : bullseye
Image Type        : full

Detecting platforms...
Detected following platforms:
  nodejs: 18.19.1
Version '18.19.1' of platform 'nodejs' is not installed. Generating script to install it...
Detected the following frameworks: Angular,Typescript


Source directory     : /__w/1/s
Destination directory: /__w/1/a


Downloading and extracting 'nodejs' version '18.19.1' to '/tmp/oryx/platforms/nodejs/18.19.1'...
Detected image debian flavor: bullseye.
Downloaded in 1 sec(s).
Verifying checksum...
Extracting contents...
performing sha512 checksum for: nodejs...
Done in 2 sec(s).

Removing existing manifest file
Creating directory for command manifest file if it does not exist
Creating a manifest file...
Node Build Command Manifest file created.

Using Node version:
node: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by node)
node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by node)
node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)
##[error]Bash exited with code '1'.
Finishing: Build

@bh3605
Copy link
Author

bh3605 commented Mar 6, 2024

Possibly related?
Azure/static-web-apps#830 (comment)

@chryw
Copy link

chryw commented Mar 8, 2024

@chryw To answer your private npm feed problem, what I've done is uploaded a .npmrc file to secure files in Azure Devops and downloaded the file to the build. You could also just add an .npmrc file yourself to your repo and make sure you have always-auth set to false. Here's the whole job template minus the input params. It can handle building an azure static web app too.

Thanks @bh3605 ! I ended up bypassing the build part that came with AzureStaticWebApp@0 task and just installed specific node version, run npm install and authentication separately using other tasks that usually work.
#2355 (comment)

Here's an example

  - stage: Build
    jobs:
      - job: Build
        displayName: Build & deploy
        pool:
          vmImage: 'ubuntu-latest'
        steps:
        - task: NodeTool@0
          inputs:
            versionSource: 'spec'
            versionSpec: '18.x'
            checkLatest: true
          displayName: 'Install Nodejs'
        - task: Npm@1
          inputs:
            command: 'install'
          displayName: 'Authenticate and install dependencies'
        - task: Npm@1
          inputs:
            command: 'custom'
            customCommand: 'run build'
          displayName: 'Build and export static Next.js app'
          # Note: Bypass the app build because this task doesn't support private feed authentication and specifying node version. Do these in usual NPM tasks above.
        - task: AzureStaticWebApp@0
          inputs:
            app_location: 'out'
            output_location: ''
            skip_app_build: true
            skip_api_build: true
            is_static_export: true
            azure_static_web_apps_api_token: '$(AZURE_STATIC_WEB_APPS_TOKEN)'
          displayName: 'Deploy to Azure static website'

@bh3605
Copy link
Author

bh3605 commented Mar 8, 2024

@chryw That's a neat trick. I'll remember that!

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

No branches or pull requests

2 participants