i’m behind a proxy and i use a vpn (globalprotect)
i m using this code :
import { scan } from 'sonarqube-scanner'
scan(
{ serverUrl: sonarServerUrl, options },
{
debug: true,
},
)
log of the first execution :
[INFO] Bootstrapper: Retrieving info from "package.json" file
[DEBUG] Bootstrapper: Setting the log level to DEBUG due to verbose mode
[DEBUG] Bootstrapper: Properties: {
'sonar.userHome': '/home/Robin.Louarn/.sonar',
'sonar.scanner.os': 'linux',
'sonar.scanner.arch': 'x64',
'sonar.exclusions': 'node_modules/**,bower_components/**,jspm_packages/**,typings/**,lib-cov/**',
'sonar.projectKey': 'poc-sofa-reports',
'sonar.projectName': 'My App',
'sonar.projectVersion': '0.1.0',
'sonar.scanner.proxyHost': 'localhost',
'sonar.scanner.proxyPort': '3128',
'sonar.projectDescription': 'Description for "My App" project...',
'sonar.sources': 'src',
'sonar.tests': 'tests',
'sonar.host.url': 'http:/.****:8080',
'sonar.verbose': 'true',
'sonar.scanner.internal.isSonarCloud': 'false',
'sonar.scanner.apiBaseUrl': 'http://**********:8080/api/v2',
'sonar.scanner.app': 'ScannerNpm',
'sonar.scanner.appVersion': '4.0.1',
'sonar.scanner.bootstrapStartTime': '1722005180515',
'sonar.scanner.wasJreCacheHit': 'disabled',
'sonar.scanner.wasEngineCacheHit': 'false',
'sonar.projectBaseDir': '/home/Robin.Louarn/git/aod-static-s3'
}
[INFO] Bootstrapper: Platform: linux x64
[DEBUG] Bootstrapper: Detecting proxy: http://localhost:3128/
[INFO] Bootstrapper: Server URL: http://*******:8080
[INFO] Bootstrapper: Version: 4.0.1
[DEBUG] Bootstrapper: Check if Server supports JRE provisioning
[DEBUG] Bootstrapper: Detecting SonarQube server version
[DEBUG] Bootstrapper: Fetching API V2 /analysis/version
[DEBUG] Bootstrapper: Unable to fetch API V2 /analysis/version: Error: Bad response: 403. Falling back on /api/server/version
[DEBUG] Bootstrapper: Not using axios instance for http://******/api/server/version
[ERROR] Bootstrapper: Failed to fetch server version: Error: Bad response: 403
[ERROR] Bootstrapper: Verify that http://****** is a valid SonarQube server
[ERROR] Bootstrapper: An error occurred: Error: Bad response: 403
after comment Agents and add proxy in configation of axios :
request.js
if (proxyUrl) {
// agents.httpsAgent = new hpagent_1.HttpsProxyAgent({ proxy: proxyUrl.toString(), ...httpsAgentOptions });
// agents.httpAgent = new hpagent_1.HttpProxyAgent({ proxy: proxyUrl.toString() });
agents.proxy = {
protocol: 'http',
host: 'localhost',
port: 3128,
}
}
[INFO] Bootstrapper: Retrieving info from "package.json" file
[DEBUG] Bootstrapper: Setting the log level to DEBUG due to verbose mode
[DEBUG] Bootstrapper: Properties: {
'sonar.userHome': '/home/Robin.Louarn/.sonar',
'sonar.scanner.os': 'linux',
'sonar.scanner.arch': 'x64',
'sonar.exclusions': 'node_modules/**,bower_components/**,jspm_packages/**,typings/**,lib-cov/**',
'sonar.projectKey': 'poc-sofa-reports',
'sonar.projectName': 'My App',
'sonar.projectVersion': '0.1.0',
'sonar.scanner.proxyHost': 'localhost',
'sonar.scanner.proxyPort': '3128',
'sonar.projectDescription': 'Description for "My App" project...',
'sonar.sources': 'src',
'sonar.tests': 'tests',
'sonar.host.url': 'http://so******m:8080',
'sonar.verbose': 'true',
'sonar.scanner.internal.isSonarCloud': 'false',
'sonar.scanner.apiBaseUrl': 'http://sonarqube-********m:8080/api/v2',
'sonar.scanner.app': 'ScannerNpm',
'sonar.scanner.appVersion': '4.0.1',
'sonar.scanner.bootstrapStartTime': '1722002967839',
'sonar.scanner.wasJreCacheHit': 'disabled',
'sonar.scanner.wasEngineCacheHit': 'false',
'sonar.projectBaseDir': '/home/Robin.Louarn/git/aod-static-s3'
}
[INFO] Bootstrapper: Platform: linux x64
[DEBUG] Bootstrapper: Detecting proxy: http://localhost:3128/
[INFO] Bootstrapper: Server URL: http://sonarqube*******om:8080
[INFO] Bootstrapper: Version: 4.0.1
[DEBUG] Bootstrapper: Check if Server supports JRE provisioning
[DEBUG] Bootstrapper: Detecting SonarQube server version
[DEBUG] Bootstrapper: Fetching API V2 /analysis/version
[DEBUG] Bootstrapper: Unable to fetch API V2 /analysis/version: AxiosError: Request failed with status code 404. Falling back on /api/server/version
[DEBUG] Bootstrapper: Not using axios instance for http://sonarqube-ic.in*******m:8080/api/server/version
[INFO] Bootstrapper: SonarQube server version: 8.9.1
[DEBUG] Bootstrapper: SonarQube Server v8.9.1 supports JRE provisioning: false
[INFO] Bootstrapper: JRE provisioning is NOT supported
[INFO] Bootstrapper: Falling back on using sonar-scanner-cli
[INFO] Bootstrapper: Starting analysis
[DEBUG] Bootstrapper: Detecting proxy: http://localhost:3128/
16:09:28.363 INFO: Scanner configuration file: /home/Robin.Louarn/.sonar/native-sonar-scanner/sonar-scanner-5.0.1.3006-linux/conf/sonar-scanner.properties
16:09:28.375 INFO: Project root configuration file: NONE
16:09:28.399 INFO: SonarScanner 5.0.1.3006
16:09:28.399 INFO: Java 17.0.7 Eclipse Adoptium (64-bit)
16:09:28.399 INFO: Linux 5.15.0-113-generic amd64
16:09:28.518 DEBUG: keyStore is :
16:09:28.518 DEBUG: keyStore type is : pkcs12
16:09:28.518 DEBUG: keyStore provider is :
16:09:28.518 DEBUG: init keystore
16:09:28.519 DEBUG: init keymanager of type SunX509
16:09:28.610 DEBUG: Create: /home/Robin.Louarn/.sonar/cache
16:09:28.611 INFO: User cache: /home/Robin.Louarn/.sonar/cache
16:09:28.611 DEBUG: Create: /home/Robin.Louarn/.sonar/cache/_tmp
16:09:28.613 DEBUG: Extract sonar-scanner-api-batch in temp...
16:09:28.616 DEBUG: Get bootstrap index...
16:09:28.616 DEBUG: Download: http://sonarqube-ic.in******m:8080/batch/index
[ERROR] Bootstrapper: 16:09:58.715 ERROR: SonarQube server [http://sonarqube-ic.int*****m:8080] can not be reached
16:09:58.715 INFO: ------------------------------------------------------------------------
16:09:58.716 INFO: EXECUTION FAILURE
16:09:58.716 INFO: ------------------------------------------------------------------------
16:09:58.717 INFO: Total time: 30.381s
16:09:58.739 INFO: Final Memory: 5M/40M
16:09:58.739 INFO: ------------------------------------------------------------------------
[ERROR] Bootstrapper: 16:09:58.739 ERROR: Error during SonarScanner execution
[ERROR] Bootstrapper: org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarScanner analysis
[ERROR] Bootstrapper: at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:85)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
[ERROR] Bootstrapper: at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:74)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:70)
at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:185)
at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:123)
at org.sonarsource.scanner.cli.Main.execute(Main.java:74)
at org.sonarsource.scanner.cli.Main.main(Main.java:62)
[ERROR] Bootstrapper: Caused by: java.lang.IllegalStateException: Fail to get bootstrap index from server
at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:42)
[ERROR] Bootstrapper: at org.sonarsource.scanner.api.internal.JarDownloader.getScannerEngineFiles(JarDownloader.java:58)
at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:53)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:76)
[ERROR] Bootstrapper: ... 7 more
[ERROR] Bootstrapper: Caused by: java.net.SocketTimeoutException: Connect timed out
[ERROR] Bootstrapper: at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(Unknown Source)
[ERROR] Bootstrapper: at java.base/sun.nio.ch.NioSocketImpl.connect(Unknown Source)
at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
[ERROR] Bootstrapper: at java.base/java.net.Socket.connect(Unknown Source)
[ERROR] Bootstrapper: at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.platform.Platform.connectSocket(Platform.java:130)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.RealConnection.connectSocket(RealConnection.java:263)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.RealConnection.connect(RealConnection.java:183)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.java:224)
[ERROR] Bootstrapper: at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.java:108)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.ExchangeFinder.find(ExchangeFinder.java:88)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.Transmitter.newExchange(Transmitter.java:169)
[ERROR] Bootstrapper: at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:41)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
[ERROR] Bootstrapper: at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
some one can help me ?