Sonar CE and donet-sonarscanner

Hello i have sonar ce 8.9 and “dotnet-sonarscanner” (versión ‘5.12.0’) When I analyze the code I get the error:

When Downloading from https://…/api/editions/is_valid_license
Unexpected character encountered while parsing value <. Path ‘’, line0, position 0
Pre-processing failed. Exit code: 1

Why community version does not have this api url?
Is there any parameter for the scanner do not consult this api url?

I tested in Sonar community 9.9 LTS and the same

Hey there.

What URL are you providing to sonar.host.url? When you put it into your browser, does it change at all (remove a trailing slash, go to a different context)…

I trayed with

DotNet sonarscanner …. /d:sonar.host.url=https://…./sonar

DotNet sonarscanner …. /d:sonar.host.url=https://…./sonar/

And the same error

Thanks.

You’re right – the logic in the Scanner should detect it’s Community Edition and proceed.

Can you let me know what the exact response is when you put https://…./sonar/api/editions/is_valid_license in your browser? It should be:

{"errors":[{"msg":"Unknown url : /api/editions/is_valid_license"}]}

The error is:
Unexpected character encountered while parsing value: <. Path ‘’ , line 0, position 0.
Pre-processing failed. Exit code: 1

Also in the webapi of sonar CE dont exist api/editions/is_valid_license

Is this the error you get when you actually put the URL in your browser? Stepping away from the scanner.

Sonar CE
With https://……/api/edition/is_valid_license
Show ( nginx reverse proxy) An error ocurred. Sorry the page you are looking for is currently unavaliable

Sonar EE
With https://…./api/editions/is_valid_license
Show (nginx reverse proxy) {“isValidLicense”:true}

And with Sonar CE
With https://……/web_api/api/edition/is_valid_license

Show an empty html

Is it possible that Nginx is directing all 404s to a cusotm error page in your setup? The scanner is (I admit, flimisly) relying on the existence of {"errors":[{"msg":"Unknown url : /api/editions/is_valid_license"}]}

I will check the nginx configuration

Yes now is working. It was the custom error page
Thank you!!!

1 Like

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