Sonar-scanner-npm@4.2.0: TypeError: Invalid URL

In our CI pipeline we are using sonarqube-scanner and with latest version sonarqube-scanner - npm

there is an error while trying to run analysis on our self-hosted sonarcube ( Version 9.9.4) server:

 npm i -g sonarqube-scanner
 npm i -g typescript
 sonar-scanner

[INFO]  Bootstrapper: Retrieving info from "package.json" file
[INFO]  Bootstrapper: Platform: linux x64
[INFO]  Bootstrapper: Server URL: http://our.domain.si:9000  
[INFO]  Bootstrapper: Version: 4.2.0
[ERROR] Bootstrapper: Failed to fetch server version: TypeError: Invalid URL
[ERROR] Bootstrapper: Verify that http://our.domain.si:9000   is a valid SonarQube server
[ERROR] Bootstrapper: An error occurred: TypeError: Invalid URL

We are using sonar-project.properties config file like this:

sonar.host.url=http://our.domain.si:9000
sonar.projectKey=app-gui
sonar.sourceEncoding=UTF-8
sonar.sources=src
sonar.tests=src
sonar.exclusions=node_modules/, dist/
sonar.test.inclusions=**/*.spec.ts
sonar.typescript.tsconfigPath=tsconfig.json
sonar.typescript.lcov.reportPaths=coverage/report-lcov/lcov.info
sonar.dependencyCheck.htmlReportPath=npm-license-report.html

With previous version, URL was OK and it worked. Are non SSL URLs no longer supported?

In changelog I can see that cli scanner was updated, but I can’t find any info on SSL being mandatory.

Can I make it work with http? Any help appreciated.

Best Regards,
Klemen

Greetings @klemen and welcome to the community :wave:

No, SSL Urls are not required. The scanner should continue to work with non-ssl servers like yours http://our.domain.si:9000.

The error you shared, TypeError: Invalid URL, indicates that something might be misconfigured regarding a URL, most likely regarding a proxy (if you have one configured).

Could you run with sonar.verbose=true? This will output all the properties being used by the scanner. My guess is that some proxy configuration isn’t valid.

I’ve just find out what the problem was. There was a trailing whitespace in the server URL in properties file that was causing problems with the latest version but not before.

After cleaning up the URL everything works now.
Thanks!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.