Must-share information (formatted with Markdown):
- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
=> Sonarqube 9.2.1, sonar-maven-plugin 3.9.1.2184, Gitlab-ci Runners (shell and maven:3.6.3-jdk-11, with Nodejs 16.15.0 (from binaries) - what are you trying to achieve
=> Make the “Sensor JavaScript analysis” work - what have you tried so far to achieve this
=> Mutliple image, multiple ci-configuration, maven debug log activation
Hello everybody,
When l try to analyse some code of ours, I get the following error everytime:
[INFO] 14:51:34.924 Sensor JavaScript analysis [javascript]
[DEBUG] 14:51:34.926 Deploying bundle
[DEBUG] 14:51:34.926 Deploying eslint-bridge into /builds/PROJECT_PATH/target/sonar/.sonartmp/eslint-bridge-bundle
[DEBUG] 14:51:36.894 Deploying bundle (done) | time=1968ms
[INFO] 14:51:36.895 Deploying custom rules bundle jar:file:/builds/PROJECT_PATH/.sonar/cache/54f02b9cc8c8e36a9aaad1b63c7a20a5/sonar-securityjsfrontend-plugin.jar!/js-vulnerabilities-rules-1.0.0.tgz to /builds/PROJECT_PATH/target/sonar/.sonartmp/eslint-bridge-bundle/package/custom-rules5187069242545992438
[DEBUG] 14:51:36.925 Starting server
[INFO] 14:51:36.927 Using Node.js executable /builds/PROJECT_PATH/node/bin/node from property sonar.nodejs.executable.
[DEBUG] 14:51:36.927 Checking Node.js version
[DEBUG] 14:51:36.928 Launching command /builds/PROJECT_PATH/node/bin/node -v
[DEBUG] 14:51:36.942 Using Node.js v16.15.0.
[DEBUG] 14:51:36.942 Starting Node.js process to start eslint-bridge server at port 39114
[DEBUG] 14:51:36.942 Launching command /builds/PROJECT_PATH/node/bin/node /builds/PROJECT_PATH/target/sonar/.sonartmp/eslint-bridge-bundle/package/bin/server 39114 127.0.0.1 /builds/PROJECT_PATH/MVN_SUBMODULE/target/sonar true false /builds/PROJECT_PATH/target/sonar/.sonartmp/eslint-bridge-bundle/package/custom-rules5187069242545992438/package
[DEBUG] 14:51:38.346 Loaded rules ucfg from /builds/PROJECT_PATH/target/sonar/.sonartmp/eslint-bridge-bundle/package/custom-rules5187069242545992438/package
[DEBUG] 14:51:38.346 starting eslint-bridge server at port 39114
[DEBUG] 14:51:38.353 eslint-bridge server is running at port 39114
[ERROR] 14:56:37.049 Failed to start server (300s timeout)
org.sonarsource.nodejs.NodeCommandException: Failed to start server (300s timeout)
at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.startServer(EslintBridgeServerImpl.java:135)
at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.startServerLazily(EslintBridgeServerImpl.java:205)
at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.execute(AbstractEslintSensor.java:116)
[...]
[INFO] 14:56:37.062 Sensor JavaScript analysis [javascript] (done) | time=302138ms
First question, does someone know what could go wrong here ?
Eslint seems to be running and started; but somehow the scanner can’t connect to it.
Looking at the code, I came to the function isAlive of EslintBridgeServerImpl
(SonarJS/EslintBridgeServerImpl.java at master · SonarSource/SonarJS · GitHub)
public boolean isAlive() {
if (nodeCommand == null) {
return false;
}
var request = HttpRequest.newBuilder(url("status")).GET().build();
try {
var response = client.send(request, BodyHandlers.ofString());
String body = response.body();
return "OK!".equals(body);
} catch (InterruptedException e) {
throw handleInterruptedException(e, "isAlive was interrupted");
} catch (IOException e) {
return false;
}
}
It would be really helpful if the IOException was not erased and would be logged, allowing to pinpoint the connection problem.
Thanks if you have any suggestions !