Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve "HttpException: Error 413" (SonarQube)

I've recently installed the latest version of Jenkins, SonarQube 6.0 (running on a separate server) and when the Jenkins job attempts to upload sonar scanner results to the SonarQube server, I get the following error:

'ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: org.sonarqube.ws.client.HttpException: Error 413 on http://****`

What could be the cause? An error in the sonar-project properties?

like image 338
Mister Tommy Cat Avatar asked Sep 14 '16 19:09

Mister Tommy Cat


3 Answers

I had the same error where my sonarqube server was behind an nginx proxy.

413 == Request entity too large as @jeroen-heier said.

I applied a change to my nginx configuration like this

server {
  ...
  client_max_body_size 20M;
  ....
}

to allow requests to be 20 megabytes, and that fixed it.

like image 117
Peter Mounce Avatar answered Oct 31 '22 13:10

Peter Mounce


If you run sonar in docker , the default sonar image does not contain nginx server, so there're nothing can do in container

I ran it in k8s, there's a ingress before sonar service, so you should config the ingress and the service

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: sonarqube
  namespace: default
  annotations:
    ingress.kubernetes.io/proxy-body-size: "20M"
spec:
  rules:
...

To get this via the helm chart, add

ingress:
  enabled: true
  annotations:
    ingress.kubernetes.io/proxy-body-size: "20M"
like image 6
yan Avatar answered Oct 31 '22 12:10

yan


In case you're using nginx-ingress, add nginx.ingress.kubernetes.io/proxy-body-size: "20M" into the annotations:

like image 5
Satjapong Meeklai Avatar answered Oct 31 '22 13:10

Satjapong Meeklai