renovatebot / renovate

Home of the Renovate CLI: Cross-platform Dependency Automation by Mend.io
https://mend.io/renovate
GNU Affero General Public License v3.0
17.1k stars 2.22k forks source link

Version 18.9.3 with Bitbucket Cloud throws "Unexpected token d in JSON at position 0" #3883

Closed danielbayerlein closed 5 years ago

danielbayerlein commented 5 years ago

What Renovate type are you using?

Renovate CLI

Describe the bug

An error occurs with the last version of renovate (18.9.3) and Bitbucket Cloud. The PRs are still created. There is no bug with my previous version of renovate (15.0.1).

Did you see anything helpful in debug logs?

ERROR: Repository has unknown error (repository=xxxx/xxxx)
"err": {
  "name": "ParseError",
  "hostname": "api.bitbucket.org",
  "method": "GET",
  "path": "/2.0/repositories/xxxx/xxxx/pullrequests/76/diff",
  "protocol": "https:",
  "url": "https://api.bitbucket.org/2.0/repositories/xxxx/xxxx/pullrequests/76/diff",
  "gotOptions": {
    "path": "/2.0/repositories/xxxx/xxxx/pullrequests/76/diff",
    "protocol": "https:",
    "hostname": "api.bitbucket.org",
    "hash": "",
    "search": "",
    "pathname": "/2.0/repositories/xxxx/xxxx/pullrequests/76/diff",
    "href": "https://api.bitbucket.org/2.0/repositories/xxxx/xxxx/pullrequests/76/diff",
    "headers": {
      "user-agent": "https://github.com/renovatebot/renovate",
      "accept": "application/json",
      "accept-encoding": "gzip, deflate"
    },
    "hooks": {
      "beforeError": [],
      "init": [],
      "beforeRequest": [],
      "beforeRedirect": [],
      "beforeRetry": [],
      "afterResponse": []
    },
    "retry": {"methods": {}, "statusCodes": {}, "errorCodes": {}},
    "decompress": true,
    "throwHttpErrors": true,
    "followRedirect": true,
    "stream": false,
    "form": false,
    "json": true,
    "cache": false,
    "useElectronNet": false,
    "method": "GET",
    "hostType": "bitbucket",
    "baseUrl": "https://api.bitbucket.org/",
    "auth": "user:$RENOVATE_PASSWORD",
    "gotTimeout": {"request": 60000}
  },
  "statusCode": 200,
  "statusMessage": "OK",
  "body": "diff --git a/package.json b/package.json\nindex cee7082..ad6abf3 100644\n--- a/package.json\n+++ b/package.json\n@@ -24,7 +24,7 @@\n     \"@ibm/plex\": \"^1.4.1\",\n     \"@xxxx/component-library\": \"^6.0.0\",\n     \"formik\": \"^1.5.7\",\n-    \"i18next\": \"^14.1.1\",\n+    \"i18next\": \"^16.0.0\",\n     \"i18next-xhr-backend\": \"^1.5.1\",\n     \"polished\": \"^3.4.0\",\n     \"prop-types\": \"^15.7.2\",\ndiff --git a/yarn.lock b/yarn.lock\nindex 545800c..fa43863 100644\n--- a/yarn.lock\n+++ b/yarn.lock\n@@ -4864,10 +4864,12 @@ i18next-xhr-backend@^1.5.1:\n   resolved \"https://registry.yarnpkg.com/i18next-xhr-backend/-/i18next-xhr-backend-1.5.1.tgz#50282610780c6a696d880dfa7f4ac1d01e8c3ad5\"\n   integrity sha512-9OLdC/9YxDvTFcgsH5t2BHCODHEotHCa6h7Ly0EUlUC7Y2GS09UeoHOGj3gWKQ3HCqXz8NlH4gOrK3NNc9vPuw==\n \n-i18next@^14.1.1:\n-  version \"14.1.1\"\n-  resolved \"https://registry.yarnpkg.com/i18next/-/i18next-14.1.1.tgz#d569aff68c088151f09fcb0cb6f44b36d62731d3\"\n-  integrity sha512-HItn9RHLyrDqe6pw6qXMYHGPHNc3y1FZndJfBlD6k4sRS0FAlYLvqCDVIWFc1XultBgsv348TtvL/lleG6JgBg==\n+i18next@^16.0.0:\n+  version \"16.0.0\"\n+  resolved \"https://registry.yarnpkg.com/i18next/-/i18next-16.0.0.tgz#57dbaae4558a8a476c5edf058a97272130c61621\"\n+  integrity sha512-2kR0Bh1j0PxFQXNxgLjGdC1REPnwEK9bgmYsRR9w+kD4hQ5V40kwxKWNoC8RKpvHL45XoavBfOjWd470aFlWOQ==\n+  dependencies:\n+    \"@babel/runtime\" \"^7.3.1\"\n \n iconv-lite@0.4.23:\n   version \"0.4.23\"\n",
  "message": "Unexpected token d in JSON at position 0 in \"https://**redacted**@api.bitbucket.org/2.0/repositories/xxxx/xxxx/pullrequests/76/diff\": \ndiff --git a/package.json b/package.json\nindex cee7082..ad6abf3 100644\n--- a/...",
  "stack": "ParseError: Unexpected token d in JSON at position 0 in \"https://**redacted**@api.bitbucket.org/2.0/repositories/xxxx/xxxx/pullrequests/76/diff\": \ndiff --git a/package.json b/package.json\nindex cee7082..ad6abf3 100644\n--- a/...\n    at EventEmitter.emitter.on (/opt/atlassian/pipelines/agent/build/node_modules/got/source/as-promise.js:65:26)\n    at <anonymous>\n    at process._tickCallback (internal/process/next_tick.js:188:7)"
}

To Reproduce

renovate.json

{
  "extends": [
    "config:base",
    ":onlyNpm"
  ],
  "ignorePresets": [
    ":prHourlyLimit2"
  ],
  "rangeStrategy": "bump"
}

Expected behavior

Raising no error :wink:

rarkins commented 5 years ago

How do you run Renovate? In particular I'm interested to know if you configure via config.js, env or CLI or a mix, and if you run with --autodiscover?

danielbayerlein commented 5 years ago

@rarkins I run Renovate with the CLI command renovate (without options) and use a config.js with the following content:

module.exports = {
  platform: 'bitbucket',
  gitAuthor: 'Renovate Bot <bot@renovateapp.com>',
  username: 'user',
  trustLevel: 'high',
  onboarding: true,
  onboardingConfig: {
    extends: [
      'config:base',
      ':onlyNpm'
    ],
    ignorePresets: [
      ':prHourlyLimit2'
    ],
    rangeStrategy: 'bump'
  },
  repositories: [
    'xxxx/component-library',
    'xxxx/boilerplate'
  ]
}
rarkins commented 5 years ago

Can you also tell me if PR 76 in that repo is conflicted or not?

danielbayerlein commented 5 years ago

There's no conflict.

rarkins commented 5 years ago

I’ve spotted the problem and will have a fix for you shortly

renovate-bot commented 5 years ago

:tada: This issue has been resolved in version 18.9.8 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

rarkins commented 5 years ago

Can you test with the latest version and confirm the problem is fixed?

rarkins commented 5 years ago

Can you test with the latest version and confirm the problem is fixed?

danielbayerlein commented 5 years ago

@rarkins Awesome - that was really fast! Works now without problems. Thank you 🥇