Scanning nextjs application by Sonarqube fails on github actions

330 Views Asked by At

I am running sonarqube analysis on a nextjs project using github action as the ci/cd tool. My workflow file looks like this.

on:
  push:
    branches:
      - dev

jobs:
  sonaranalysis:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: SonarQube Analysis
        uses: sonarsource/sonarqube-scan-action@master
        env:
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
          SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

      - name: Sonarqube Quality Gate Check
        id: sonarqube-quality-gate-check
        uses: sonarsource/sonarqube-quality-gate-action@master
        timeout-minutes: 5
        env:
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
          SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

      - name: "Example show SonarQube Quality Gate Status value"
        run: echo "The Quality Gate status is ${{ steps.sonarqube-quality-gate-check.outputs.quality-gate-status }}"
  
  createpr:
    needs: sonaranalysis
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          ref: staging
      - name: Reset branch
        run: |
          git fetch origin dev:dev
          git reset --hard dev
          
      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v5
        with:
          branch: stage-promotion
          delete-branch: true

Errorlog seen while running the workflow looks like below

INFO: SCM Publisher 487 source files to be analyzed
INFO: SCM Publisher 487/487 source files have been analyzed (done) | time=6530ms
INFO: CPD Executor 59 files had no CPD blocks
INFO: CPD Executor Calculating CPD for 387 files
INFO: CPD Executor CPD calculation finished (done) | time=175ms
INFO: Analysis report generated in 141ms, dir size=4.5 MB
INFO: Analysis report compressed in 994ms, zip size=2.6 MB
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:26.977s
INFO: Final Memory: 18M/64M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: Failed to upload report: Error 413 on ***/api/ce/submit?projectKey=astris-fe : <html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx/1.20.1</center>
</body>
</html>

    at org.sonar.scanner.report.ReportPublisher.upload(ReportPublisher.java:226)
    at org.sonar.scanner.report.ReportPublisher.execute(ReportPublisher.java:154)
    at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:376)
    at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
    at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
    at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:137)
    at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
    at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
    at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
    at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
    at com.sun.proxy.$Proxy0.execute(Unknown Source)
    at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
    at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
    at org.sonarsource.scanner.cli.Main.main(Main.java:62)
Caused by: org.sonarqube.ws.client.HttpException: Error 413 on ***/api/ce/submit?projectKey=astris-fe : <html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx/1.20.1</center>
</body>
</html>

    at org.sonarqube.ws.client.BaseResponse.failIfNotSuccessful(BaseResponse.java:36)
    at org.sonar.scanner.bootstrap.DefaultScannerWsClient.failIfUnauthorized(DefaultScannerWsClient.java:126)
    at org.sonar.scanner.bootstrap.DefaultScannerWsClient.call(DefaultScannerWsClient.java:89)
    at org.sonar.scanner.report.ReportPublisher.upload(ReportPublisher.java:224)
    ... 21 more
ERROR: 
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

Sonarqube is behind NGINX proxy. I am very new to github and sonarqube. I don't know if i am missing something silly.

I tried to reinstall the sonarqube. Did everything from scratch. I change from centos 8 to 7. However the issue still persists. Has any one faced the same issue?

0

There are 0 best solutions below