Hi Ann, thanks to answer quickly. My CI server hasn’t Java installed, it is possible that the Scanner that downloads the npm is using its own embedded JRE?. Should I explicitly set some version of SonarScanner for npm with JDK17?
I don’t have a deep knowledge of npm, but it’s true there’s a version of the scanner that embeds a JVM. You need to make sure the underlying SonarScanner CLI is at the latest version.
I moved your conversation into a dedicated thread because I have the feeling it’s going to take a couple of exchanges to be resolved.
The latest version of the sonarqube-scanner for NPM downloads the required sonar-scanner-cli which itself embeds the good and expected Java17.
So normally, you have nothing to do if your configuration is saying: get the latest version of sonarqube-scanner.
I’m not familiar with NPM but can you try to force the version of the sonarqube-scanner or clear some cache here and there to make sure the latest version is used?
Also, can you share the error message you see?
Thanks Alex, yeah I just updated my dependency in the package.json and it works. I don’t say that it going work for all cases but it was enough for me. My FE project has Angular, Eslint, Karma and Jasmine
Hi Alex, Ann
Since I updated the sonar scanner for NPM version to 3.1.0 (to be compatible with JDK 17), I was getting this “Exception” warning with the Kendo plugin, however the scanner process was taking it as a warning and ending the analysis was successful and the results were finally reported to SonarCloud.
However, starting in January 29th this is considered an “Error” and my analysis ends with an error and of course does not report anything.
Any idea what could have happened?
Data
@angular/core: ^8.2.14
@angular/compiler-cli: ^8.2.14
typescript: ^3.4.5
sonarqube-scanner: ^3.1.0
karma-sonarqube-reporter: ^1.4.0,
karma-sonarqube-unit-reporter: ^0.0.23,
@types/node: ^13.7.1
@progress/kendo-data-query: ^1.5.2
@progress/kendo-angular-grid: ^4.6.3
Before Jan 29th,2024
ERROR: Failure during analysis
java.lang.IllegalArgumentException: Unable to create symbol on file src/app/shared/kendo-list/kendo-list.component.ts
at org.sonar.api.batch.sensor.symbol.internal.DefaultSymbolTable.newSymbol(DefaultSymbolTable.java:57)
at org.sonar.plugins.javascript.bridge.AnalysisProcessor.saveHighlightedSymbols(AnalysisProcessor.java:203)
.....
Caused by: java.lang.IllegalArgumentException: Start pointer [line=644, lineOffset=22] should be before end pointer [line=644, lineOffset=22]
at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
at org.sonar.api.batch.fs.internal.DefaultInputFile.newRangeValidPointers(DefaultInputFile.java:347)
.....
INFO: SCM writing changed lines (done) | time=8450ms
INFO: Analysis report generated in 8931ms, dir size=21 MB
INFO: Analysis report compressed in 3898ms, zip size=10 MB
INFO: Analysis report uploaded in 1366ms
INFO: ANALYSIS SUCCESSFUL, you can find the results at: https://sonarcloud.io/dashboard?id=xxxx
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at https://sonarcloud.io/api/ce/task?id=xxxxxxxx
INFO: Sensor cache published successfully
INFO: Analysis total time: 2:24.667 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 2:26.258s
INFO: Final Memory: 20M/88M
INFO: ------------------------------------------------------------------------
[19:24:08] Analysis finished.
After Jan 29th,2024
ERROR: Failure during analysis
java.lang.IllegalArgumentException: Unable to create symbol on file src/app/shared/kendo-list/kendo-list.component.ts
at org.sonar.api.batch.sensor.symbol.internal.DefaultSymbolTable.newSymbol(DefaultSymbolTable.java:57)
at org.sonar.plugins.javascript.bridge.AnalysisProcessor.saveHighlightedSymbols(AnalysisProcessor.java:203)
.....
Caused by: java.lang.IllegalArgumentException: Start pointer [line=644, lineOffset=22] should be before end pointer [line=644, lineOffset=22]
at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
at org.sonar.api.batch.fs.internal.DefaultInputFile.newRangeValidPointers(DefaultInputFile.java:347)
.....
INFO: Hit the cache for 0 out of 867
INFO: Miss the cache for 867 out of 867: ANALYSIS_MODE_INELIGIBLE [867/867]
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 2:08.519s
INFO: Final Memory: 21M/88M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: Analysis of JS/TS files failed
at org.sonar.plugins.javascript.bridge.AbstractBridgeSensor.execute(AbstractBridgeSensor.java:102)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:62)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:75)
....
ERROR:
(node:342) UnhandledPromiseRejectionWarning: Error: Command failed: /$WORKSPACE_RUNNER_USERNAME/.sonar/native-sonar-scanner/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner --from=ScannerNpm/3.3.0
at checkExecSyncError (child_process.js:790:11)
at execFileSync (child_process.js:827:15)
at scan (/opt/atlassian/pipelines/agent/build/node_modules/sonarqube-scanner/src/index.js:40:3)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:342) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:342) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
On the 29th we rolled out a change that made Node.js mandatory for analysis. Previously, errors in JS/TS analysis showed up in the log, but didn’t fail analysis. Now they do. So you’re feeling a side effect of that.
If you’d like to pursue this, could you create a new thread, please?