Hi,
to be mentioned at the beginning: I am not sure, if the selected category is the correct one for this topic.
I recently updated our self-hosted SonarQube instance to the latest 8.7.0. Some of our projects use TypeScript so the scanner analyses .ts files. This worked well with the previously used SonarQube version 8.4.2.
After upgrading, I recently got connection timeouts from a node server that wants to get started. After searching in the community I found a quite similar but not completely identical bug report and that it might be an incompatible node.js version used in our project.
Referring to the official documentation for analysing JavaScript/Typescript files Node.js >= 10
is supported. We use Node.js 11.15.0 (for this legacy branch) so I thought we are good to go. Unfortunately I got the following error:
ERROR: /workspace/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/queue-microtask/index.js:5
ERROR: ? queueMicrotask.bind(globalThis)
ERROR: ^
ERROR:
ERROR: ReferenceError: globalThis is not defined
ERROR: at Object.<anonymous> (/workspace/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/queue-microtask/index.js:5:25)
ERROR: at Module._compile (internal/modules/cjs/loader.js:816:30)
ERROR: at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
ERROR: at Module.load (internal/modules/cjs/loader.js:685:32)
ERROR: at Function.Module._load (internal/modules/cjs/loader.js:620:12)
ERROR: at Module.require (internal/modules/cjs/loader.js:723:19)
ERROR: at require (internal/modules/cjs/helpers.js:14:16)
ERROR: at Object.<anonymous> (/workspace/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/run-parallel/index.js:4:24)
ERROR: at Module._compile (internal/modules/cjs/loader.js:816:30)
ERROR: at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
causing
ERROR: Failed to start server (60s timeout)
org.sonarsource.nodejs.NodeCommandException: Failed to start server (60s timeout)
at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.startServer(EslintBridgeServerImpl.java:124)
at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.startServerLazily(EslintBridgeServerImpl.java:186)
at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.startBridge(AbstractEslintSensor.java:145)
at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.execute(AbstractEslintSensor.java:119)
at org.sonar.plugins.javascript.eslint.JavaScriptEslintBasedSensor.execute(JavaScriptEslintBasedSensor.java:51)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:389)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:385)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:354)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:144)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
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:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
which didn’t stop the the scanner from further activity and finally sending incorrect data to SonarQube.
After some research, this error seems to be related to a package issue of queue-microtask
pointing out that Node.js 11 is not a supported version.
A bit later I found the scanner property sonar.nodejs.executable
to tell the scanner it has to use a specific Node.js binary. Pointing to a Node.js >= 12
, the scanner now successfully scans Typescript files so my problem is solved.
This makes me wonder if the documentation might not be correct regarding the necessary Node.js version for the scanner?
Thanks in advance for your response.
Kind regards,
Steven