Sonarsource/sonarcloud-github-action failing with Node.js 12 error

Hey y’all! I’ve been using SonarCloud for almost a year now, and I’m absolutely loving it. I have it integrated into my GitHub Actions with sonarsource/sonarcloud-github-action@master, and recently, the action has been failing saying that Node.js 12 is not supported. However, it’s running in a Docker container provided by SonarCloud in the action, and I’m using the most up-to-date version of the action. Does anyone know what’s going on?

Actions Log
Workflow (just running the provided action at master)

The version of node.js (12) you have used to run this analysis is deprecated and we stopped accepting it.

Thanks!

7 Likes

Came to report the same issue. Existing implementation of GitHub Action using SonarSource/sonarcloud-github-action@master is suddenly complaining that NodeJS 12 is no longer accepted. The GitHub Action is running on the SonarSource supplied image. Please update the image to use a newer version of Node. :slight_smile:

Ran into the same issue, I am running scan in Gihub Actions, below is the error I am getting

The version of node.js (12) you have used to run this analysis is deprecated and we stopped accepting it.

I am using node 18.16.0 in actions/setup-node@v3 step before sonarcloud scan

Any quick fixes?

Came here for the same issue. NodeJS version is managed by SonarCloud action dockerfile, so we don’t have the opportunity to change it.

PS: For now as a quick fix we did a rollback using v1.8 of the action:

- uses: actions/checkout@v3
        with:
          fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarCloud Scan
        uses: SonarSource/sonarcloud-github-action@v1.8
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
9 Likes

Same here.

My GitHub Actions configuration that was unchanged for several months and worked until today:

name: scan-with-sonar-develop
on:
  push:
    branches:
      - develop
  workflow_dispatch:
jobs:
  main:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout develop branch
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
          ref: develop
      - name: Setup node
        uses: actions/setup-node@v3
        with:
          node-version: 16
      - name: Install dependencies
        run: npm install
      - name: Scan with sonar
        uses: SonarSource/sonarcloud-github-action@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
        with:
          args: >
            -Dsonar.branch.name=develop

As of today, I am receiving this error:

The version of node.js (12) you have used to run this analysis is deprecated and we stopped accepting it.
Please update to at least node.js 14. You can find more information here: https://docs.sonarcloud.io/appendices/scanner-environment/

This error message looks buggy, because it assumes that my node version is 12 or below, while it is actually 16:

Run actions/setup-node@v3
Found in cache @ /opt/hostedtoolcache/node/16.20.0/x64
Environment details

Same here. I try to re-run it on old branch that works fine before. And it’s fail.
The test is fail when testing javascript. But with golang scan, it works fine.

Also having the same issue. I’ve been debugging and confirmed that my node version is not 12.

Can confirm that the workaround proposed by Leonardo_Ascione has worked for me.

1 Like

Hello, I am also having the same issue.
Here is the way I am using the action :

  • uses: actions/setup-node@v3
    with:
    node-version-file: ‘.nvmrc’
    cache: ‘npm’
    - name: SonarCloud Scan
    uses: sonarsource/sonarcloud-github-action@master
    env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

Same issue here.
I triple checked that GH actions is not using nodejs 12, and all GH hosted runners are using 16 by default (according to an old article).
Manually setup-node to use version 16, no luck.
Checked this thread, assuming it’s a SC issue at this stage. :frowning:

We have the same issue, pipeline failing with:

The version of node.js (12) you have used to run this analysis is deprecated and we stopped accepting it.
Please update to at least node.js 14. You can find more information here: https://docs.sonarcloud.io/appendices/scanner-environment/

I guess that why we shouldn’t use @master :upside_down_face:

1 Like

I have the same issue here.

  1. Why did sonarcloud change its version requirement without updating the github action?
  2. Why are you still using node 12 in 2023???

When will the docker image be fixed? As I’m sure is the case for many others, we have numerous workflows using this action and changing all of them for the short-term to change them back isn’t the best use of time.

As a sidenote, why is master suggested as the tag to use? Can the action move to using major version tags such as v1 like a majority of actions do? That way, if an issue like this arises again the major version tag can be pointed back to a previous release until a proper fix for the new release is out.

1 Like

Even though you use branch that works, anything after 1.8 will fail -it works before. They didn’t made fail change to repo. Instead they push sonar-scanner-cli:4.8 again with error which is outside the code.

Out team uses the sonarsource/sonar-scanner-cli:4 container image (tekton pipelines) and pipelines across all our application repositories are failing. For some, we have been reverting to sonarsource/sonar-scanner-cli:4.7. (this reminds us that we should probably template that)

Hello everyone, thanks a lot for reporting that issue,

We apologies for the inconvenience caused by mis-release of the cli.

The issue will be resolved soon, and we will keep you posted here.

3 Likes

Thanks Jeremy. Could Sonar consider adding “issues” support to your action repo on GitHub please? Users of the action are already users of GitHub and that’s naturally the first place we check. I couldn’t find this info using Google, I came from the code commit on the release.

3 Likes

Hey everyone.

We’ll take time after the incident is resolved to take your feedback into consideration and understand how we can do better next time.

We expect to push a new version of sonar-scanner-cli-docker soon (which will cascade its way into the GitHub Action).

I’ll provide an update within the half-hour.

We’re very sorry for the inconvenience and we appreciate your patience.

3 Likes

RE: using major version / master. That wouldn’t have helped in this case because the erroneous version is still a v1.X version.

afaict, this is an unintentional breaking change, though yes I agree pinning major versions of GH Actions should be the default because then any breaking changes can be made without breaking people’s workflows that are using master

Hey everyone.

The push of the new version of sonar-scanner-cli-docker is almost done. I will keep providing updates here.