codacy / codacy-coverage-reporter

Multi-language coverage reporter for Codacy
https://www.codacy.com
Other
134 stars 94 forks source link

[DOCS-381] Add troubleshooting for "Failed to upload coverage report ... connect timed out" #383

Closed prcr closed 2 years ago

prcr commented 2 years ago

If you're getting a Failed to upload coverage report ... connect timed out error while uploading your coverage data to Codacy it can mean that you're uploading large coverage reports and that call to the Codacy API is timing out.

To solve the issue, you should use the flag --http-timeout to specify a larger timeout. For example, to specify a timeout of 10 seconds:

bash <(curl -Ls https://coverage.codacy.com/get.sh) report --http-timeout 10000 -r coverage.xml

The documentation page Troubleshooting common issues should be updated to include this scenario. See CY-6072 for more background information.

github-actions[bot] commented 2 years ago

Internal ticket created : DOCS-381

prcr commented 2 years ago

Currently, the Codacy Coverage Reporter GitHub Action doesn't support the --http-timeout, so these troubleshooting instructions apply only to the "regular" CLI.

rahul181198 commented 2 years ago

how to add this flag in the gradle task format

prcr commented 2 years ago

Hello @rahul181198,

I haven't actually tested this, but by looking at our example Gradle tasks I expect that adding the flag like in this example should work:

[...]

task sendCoverageToCodacy(type: JavaExec, dependsOn: jacocoTestReport) {
    main = "com.codacy.CodacyCoverageReporter"
    classpath = configurations.codacy
    args = [
            "report",
            "--http-timeout",
            "10000",
            "-l",
            "Java",
            "-r",
            "${buildDir}/reports/jacoco/test/jacocoTestReport.xml"
    ]
}

Let us know if this example is enough to made it work or if you still need help.

rahul181198 commented 2 years ago

I get this in exception . When I try above syntax

Unrecognized argument: --http-timeout

prcr commented 2 years ago

I verified that the last Codacy Coverage Reporter version that we published to the Maven Central Repository is quite outdated and doesn't include the --http-timeout flag yet, which was added on version 12.3.0:

https://search.maven.org/artifact/com.codacy/codacy-coverage-reporter

I'm checking this internally with the Engineering teams and I'll let you know once I have an update.

prcr commented 2 years ago

Hello again @rahul181198,

After your feedback, we're updating our Gradle task example to ensure that it uses the latest version of the Codacy Coverage Reporter.

Please check out the changes in https://github.com/codacy/codacy-coverage-reporter/pull/390 and let us know if this new template works for you. In particular, you can now add the --http-timeout flag as an extra argument at the end of the command for running the Coverage Reporter.

rahul181198 commented 2 years ago

I already tried the same syntax but it gives me log that it is sending the coverage report but I get no log about it being successful and being received like I used to get before .My build though is successful but i see no coverage in dashboard.

prcr commented 2 years ago

@rahul181198, it's possible that there's now a different issue that may be causing that. Could you please reach out to support@codacy.com providing the details on how you're running the Codacy Coverage Reporter and the resulting logs so that our Support team can help you troubleshoot your setup?