Template for a good new topic, formatted with Markdown:
- ALM used: Bitbucket Cloud
- CI system used: Shippable
- Languages of the repository: Typescript
- Only if the SonarCloud project is public, the URL: SonarCloud
- Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
- Steps to reproduce: Everytime I build with CI, or run cmd from local
- Potential workaround: Give “Anyone”, “Execute Analysis permission”
I am the administrator. I created a login key and I’m using it like below.
npm run sonar -Dsonar.login=XXXXXXXX -Dsonar.projectVersion=0.0.3 -Dsonar.pullrequest.branch=bugfix/issue-7-sonar-analysis -Dsonar.pullrequest.key=false -Dsonar.pullrequest.base= -Dsonar.issuesReport.console.enable=true -Dsonar.pullrequest.provider=bitbucketcloud -Dsonar.pullrequest.bitbucketcloud.repository=resume -Dsonar.pullrequest.bitbucketcloud.owner= -Dsonar.pullrequest.bitbucketcloud.triggerCommit=61987a70c993c24bf1421d3e924fc7aa98739aa4
and it fails.
> sonar-scanner
19:20:25.617 INFO: Load project repositories
19:20:26.206 DEBUG: GET 403 https://sonarcloud.io/batch/project.protobuf?key=com.yalimaytul%3Aresume | time=589ms
19:20:26.212 ERROR: Cannot analyze file src/app/footer/footer.component.html
java.lang.IllegalStateException: You’re not authorized to run analysis. Please contact the project administrator.
at org.sonar.scanner.scan.filesystem.MetadataGenerator.setMetadata(MetadataGenerator.java:55)
at org.sonar.scanner.scan.filesystem.FileIndexer.lambda$indexFile$0(FileIndexer.java:127)
at org.sonar.api.batch.fs.internal.DefaultInputFile.checkMetadata(DefaultInputFile.java:77)
at org.sonar.api.batch.fs.internal.DefaultInputFile.charset(DefaultInputFile.java:216)
at org.sonar.plugins.html.core.HtmlSensor.execute(HtmlSensor.java:106)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:34)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:78)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:51)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:69)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:51)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:68)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:122)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:108)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:418)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:414)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:372)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:122)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:108)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:126)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:122)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:108)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:58)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)
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:171)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)
at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: org.sonar.api.utils.MessageException: You’re not authorized to run analysis. Please contact the project administrator.
…
19:20:29.067 INFO: Load project repositories
19:20:29.627 DEBUG: GET 403 https://sonarcloud.io/batch/project.protobuf?key=com.yalimaytul%3Aresume | time=560ms
19:20:29.656 DEBUG: stylelint-bridge server will shutdown
19:20:29.659 INFO: ------------------------------------------------------------------------
19:20:29.660 INFO: EXECUTION FAILURE
19:20:29.660 INFO: ------------------------------------------------------------------------
19:20:29.661 INFO: Total time: 45.487s
19:20:29.772 INFO: Final Memory: 28M/97M
19:20:29.772 INFO: ------------------------------------------------------------------------
19:20:29.772 ERROR: Error during SonarQube Scanner execution
19:20:29.772 ERROR: You’re not authorized to run analysis. Please contact the project administrator.
19:20:29.772 ERROR: Caused by: You’re not authorized to run analysis. Please contact the project administrator.
19:20:29.772 ERROR:
19:20:29.772 ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! web@0.0.3 sonar: sonar-scanner
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the web@0.0.3 sonar script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
What determines the user that’s running the analysis? I created the login key with an administrator user and used the same login key to run the analysis. Why this is not working?
User is Admin, organization bound to Bitbucket, user created key is used in the call. This should be working! I’m not sure what’s missing here?