test-reporter icon indicating copy to clipboard operation
test-reporter copied to clipboard

Confusing error when API responds with HTML instead of JSON

Open kpheasey opened this issue 8 years ago • 10 comments

I suddenly started receiving this error today on CircleCI 2.0

Failing command: ./cc-test-reporter upload-coverage 
Exit code: 255 
Output:
Error: invalid character '<' looking for beginning of value
Usage:
  cc-test-reporter upload-coverage [flags]

Here's the relevant lines from my config.yml

# send to codelcimate
- run: ./cc-test-reporter format-coverage -t simplecov $CIRCLE_ARTIFACTS/coverage/.resultset.json
- run: ./cc-test-reporter upload-coverage --exit-code

To get around this problem, I've changed the last line to - run: ./cc-test-reporter upload-coverage --exit-code$? || true. This is based on a comment in another issue.

kpheasey avatar Oct 28 '17 23:10 kpheasey

Hi @kpheasey!

Thanks for opening this issue. On Saturday, we completed a scheduled maintenance operation which required downtime. My colleague wrote some notes up in a comment on another, similar issue about the improvements we can make for the test-reporter to behave better during maintenance windows.

Since then, we've made a change so that the test reporter binary is still available during maintenance windows. The upload-coverage step still fails, though, which is expected at this time. One thing we should improve is how the test-reporter fails. Right now, it expects that all responses will be valid JSON, but during maintenance windows the API responds with HTML. This leads to the obtuse error message you saw. I'll add the bug label and update the title of this issue to track that bug.

maxjacobson avatar Oct 30 '17 14:10 maxjacobson

@maxjacobson I haven't gotten test results reports back to GitHub since this error happened, even after remove --exit-code.....

kpheasey avatar Nov 07 '17 17:11 kpheasey

@kpheasey Ah, sorry to hear that! It sounds like you're having an issue unrelated to our maintenance window, then. Will you please write in to our great support team at https://codeclimate.com/help with details on which repo is affected and what exactly you're seeing?

maxjacobson avatar Nov 07 '17 21:11 maxjacobson

:sparkles: This is an old work account. Please reference @brandonchinn178 for all future communication :sparkles:


this happened for us 15 minutes ago. I just checked the status page, and it doesn't look like there were any scheduled downtimes. Is there any other reason why the API might send back HTML?

+ cc-test-reporter upload-coverage -i .ci/codeclimate.total.json
Error: invalid character '<' looking for beginning of value
Usage:
  cc-test-reporter upload-coverage [flags]

Flags:
  -s, --batch-size int    batch size for source files (default 500)
  -e, --endpoint string   endpoint to upload coverage information to (default "https://api.codeclimate.com/v1/test_reports")
  -r, --id string         reporter identifier (default "****************************************************************")
  -i, --input string      input path (default "coverage/codeclimate.json")
      --insecure          send coverage insecurely (without HTTPS)

brandon-leapyear avatar Mar 04 '20 21:03 brandon-leapyear

:sparkles: This is an old work account. Please reference @brandonchinn178 for all future communication :sparkles:


Maybe if the response isn't JSON, include the response body in the message, so we can at least see the full HTML that was returned? https://github.com/codeclimate/test-reporter/blob/master/upload/uploader.go#L238-L241

brandon-leapyear avatar Mar 04 '20 21:03 brandon-leapyear

It's happening with me right now

marcelinhov2 avatar Apr 01 '20 21:04 marcelinhov2

I just experienced this as well.

josephfrazier avatar Jun 01 '20 18:06 josephfrazier

This is still happening

letiesperon avatar Apr 12 '22 13:04 letiesperon

I'm going to unsubscribe from this issue because I haven't worked at CC in a few years, but I'll tag in @fede-moya as a recent committer to evaluate this feedback :)

maxjacobson avatar Apr 12 '22 14:04 maxjacobson

happening again now

https://codeclimate.com/status

Site Maintenance

We're currently offline for scheduled maintenance. We're very sorry about this, and will be back online as soon as possible. Please see our status site for more information.

<!DOCTYPE html>
<html><head>
    <meta charset="utf-8">
    <title>Site Maintenance</title>
  </head>
  <body>
    <div style="width: 740px; display: block; margin: 100px auto 0 auto;">
        <h1 style="font-family: helvetica, arial, sans-serif; font-size: 40px; color: #232323; padding-top: 20px; margin: 0 0 20px 0">Site Maintenance</h1>
        <div class="section">
          <p style="font-family: helvetica, arial, sans-serif; font-size: 20px; line-height: 25px; color: #232323; margin: 0">We're currently offline for scheduled maintenance. We're very sorry about this, and will be back online as soon as possible.</p>
          <p style="font-family: helvetica, arial, sans-serif; font-size: 12px; line-height: 20px; color: #232323; margin: 0">Please see <a href="http://status.codeclimate.com/">our status site</a> for more information.</p>
        </div>
    </div>
  

</body></html>
<head>
    <meta charset="utf-8">
    <title>Site Maintenance</title>
  </head>
<meta charset="utf-8">
<title>Site Maintenance</title>
<head>
    <meta charset="utf-8">
    <title>Site Maintenance</title>
  </head>
<body>
    <div style="width: 740px; display: block; margin: 100px auto 0 auto;">
        <h1 style="font-family: helvetica, arial, sans-serif; font-size: 40px; color: #232323; padding-top: 20px; margin: 0 0 20px 0">Site Maintenance</h1>
        <div class="section">
          <p style="font-family: helvetica, arial, sans-serif; font-size: 20px; line-height: 25px; color: #232323; margin: 0">We're currently offline for scheduled maintenance. We're very sorry about this, and will be back online as soon as possible.</p>
          <p style="font-family: helvetica, arial, sans-serif; font-size: 12px; line-height: 20px; color: #232323; margin: 0">Please see <a href="http://status.codeclimate.com/">our status site</a> for more information.</p>
        </div>
    </div>
  

</body>
<div style="width: 740px; display: block; margin: 100px auto 0 auto;">
        <h1 style="font-family: helvetica, arial, sans-serif; font-size: 40px; color: #232323; padding-top: 20px; margin: 0 0 20px 0">Site Maintenance</h1>
        <div class="section">
          <p style="font-family: helvetica, arial, sans-serif; font-size: 20px; line-height: 25px; color: #232323; margin: 0">We're currently offline for scheduled maintenance. We're very sorry about this, and will be back online as soon as possible.</p>
          <p style="font-family: helvetica, arial, sans-serif; font-size: 12px; line-height: 20px; color: #232323; margin: 0">Please see <a href="http://status.codeclimate.com/">our status site</a> for more information.</p>
        </div>
    </div>
<h1 style="font-family: helvetica, arial, sans-serif; font-size: 40px; color: #232323; padding-top: 20px; margin: 0 0 20px 0">Site Maintenance</h1>
<div class="section">
          <p style="font-family: helvetica, arial, sans-serif; font-size: 20px; line-height: 25px; color: #232323; margin: 0">We're currently offline for scheduled maintenance. We're very sorry about this, and will be back online as soon as possible.</p>
          <p style="font-family: helvetica, arial, sans-serif; font-size: 12px; line-height: 20px; color: #232323; margin: 0">Please see <a href="http://status.codeclimate.com/">our status site</a> for more information.</p>
        </div>
<p style="font-family: helvetica, arial, sans-serif; font-size: 20px; line-height: 25px; color: #232323; margin: 0">We're currently offline for scheduled maintenance. We're very sorry about this, and will be back online as soon as possible.</p>
We're currently offline for scheduled maintenance. We're very sorry about this, and will be back online as soon as possible.
<p style="font-family: helvetica, arial, sans-serif; font-size: 20px; line-height: 25px; color: #232323; margin: 0">We're currently offline for scheduled maintenance. We're very sorry about this, and will be back online as soon as possible.</p>
<p style="font-family: helvetica, arial, sans-serif; font-size: 12px; line-height: 20px; color: #232323; margin: 0">Please see <a href="http://status.codeclimate.com/">our status site</a> for more information.</p>
Please see 
<a href="http://status.codeclimate.com/">our status site</a>
 for more information.
<p style="font-family: helvetica, arial, sans-serif; font-size: 12px; line-height: 20px; color: #232323; margin: 0">Please see <a href="http://status.codeclimate.com/">our status site</a> for more information.</p>
<div class="section">
          <p style="font-family: helvetica, arial, sans-serif; font-size: 20px; line-height: 25px; color: #232323; margin: 0">We're currently offline for scheduled maintenance. We're very sorry about this, and will be back online as soon as possible.</p>
          <p style="font-family: helvetica, arial, sans-serif; font-size: 12px; line-height: 20px; color: #232323; margin: 0">Please see <a href="http://status.codeclimate.com/">our status site</a> for more information.</p>
        </div>
<div style="width: 740px; display: block; margin: 100px auto 0 auto;">
        <h1 style="font-family: helvetica, arial, sans-serif; font-size: 40px; color: #232323; padding-top: 20px; margin: 0 0 20px 0">Site Maintenance</h1>
        <div class="section">
          <p style="font-family: helvetica, arial, sans-serif; font-size: 20px; line-height: 25px; color: #232323; margin: 0">We're currently offline for scheduled maintenance. We're very sorry about this, and will be back online as soon as possible.</p>
          <p style="font-family: helvetica, arial, sans-serif; font-size: 12px; line-height: 20px; color: #232323; margin: 0">Please see <a href="http://status.codeclimate.com/">our status site</a> for more information.</p>
        </div>
    </div>
<body>
    <div style="width: 740px; display: block; margin: 100px auto 0 auto;">
        <h1 style="font-family: helvetica, arial, sans-serif; font-size: 40px; color: #232323; padding-top: 20px; margin: 0 0 20px 0">Site Maintenance</h1>
        <div class="section">
          <p style="font-family: helvetica, arial, sans-serif; font-size: 20px; line-height: 25px; color: #232323; margin: 0">We're currently offline for scheduled maintenance. We're very sorry about this, and will be back online as soon as possible.</p>
          <p style="font-family: helvetica, arial, sans-serif; font-size: 12px; line-height: 20px; color: #232323; margin: 0">Please see <a href="http://status.codeclimate.com/">our status site</a> for more information.</p>
        </div>
    </div>
  

</body>
<html><head>
    <meta charset="utf-8">
    <title>Site Maintenance</title>
  </head>
  <body>
    <div style="width: 740px; display: block; margin: 100px auto 0 auto;">
        <h1 style="font-family: helvetica, arial, sans-serif; font-size: 40px; color: #232323; padding-top: 20px; margin: 0 0 20px 0">Site Maintenance</h1>
        <div class="section">
          <p style="font-family: helvetica, arial, sans-serif; font-size: 20px; line-height: 25px; color: #232323; margin: 0">We're currently offline for scheduled maintenance. We're very sorry about this, and will be back online as soon as possible.</p>
          <p style="font-family: helvetica, arial, sans-serif; font-size: 12px; line-height: 20px; color: #232323; margin: 0">Please see <a href="http://status.codeclimate.com/">our status site</a> for more information.</p>
        </div>
    </div>
  

</body></html>

paulz avatar Dec 16 '22 04:12 paulz