renovatebot / github-action

Other
287 stars 80 forks source link

Response code 403 (Forbidden) GitHub failure: Resource not accessible by integration #595

Closed ckstevenson closed 2 years ago

ckstevenson commented 2 years ago

A few weeks back I tested the action with a GitHub App, and everything worked well. I recreated the configuration again, and now I get following on the 'Self-hosted renovate' step. The configs work fine with a PAT, and I enabled the permissions for contents, metadata and PR as per the doc. I re-entered the secrets, but I verified they work with a JWT and API request. I want to say I did something wrong this time around, but if so, I do not know.

Status: Downloaded newer image for renovate/renovate:31.14.1-slim
DEBUG: Using RE2 as regex engine
DEBUG: Parsing configs
DEBUG: Checking for config file in /github-action/renovate.json
DEBUG: File config
       "config": {
         "branchPrefix": "renovate/",
         "gitAuthor": "Renovate Bot <bot@renovateapp.com>",
         "onboarding": false,
         "platform": "github",
         "requireConfig": false,
         "repositories": ["ckstevenson/inf-tests"],
         "labels": ["dependencies", "infra-sync-required"],
         "enabledManagers": ["jenkins"],
         "packageRules": [
           {
             "description": "Jenkins plugins dependency matching properties",
             "matchUpdateTypes": [
               "pin",
               "digest",
               "patch",
               "minor",
               "major",
               "lockFileMaintenance"
             ]
           }
         ]
       }
DEBUG: CLI config
       "config": {}
DEBUG: Env config
       "config": {"hostRules": [], "binarySource": "docker", "token": "***********"}
DEBUG: Combined config
       "config": {
         "branchPrefix": "renovate/",
         "gitAuthor": "Renovate Bot <bot@renovateapp.com>",
         "onboarding": false,
         "platform": "github",
         "requireConfig": false,
         "repositories": ["ckstevenson/inf-tests"],
         "labels": ["dependencies", "infra-sync-required"],
         "enabledManagers": ["jenkins"],
         "packageRules": [
           {
             "description": "Jenkins plugins dependency matching properties",
             "matchUpdateTypes": [
               "pin",
               "digest",
               "patch",
               "minor",
               "major",
               "lockFileMaintenance"
             ]
           }
         ],
         "hostRules": [],
         "binarySource": "docker",
         "token": "***********"
       }
DEBUG: Found valid git version: 2.34.1
DEBUG: Using default github endpoint: https://api.github.com/
DEBUG: GitHub failure: Resource not accessible by integration
       "err": {
         "name": "HTTPError",
         "code": "ERR_NON_2XX_3XX_RESPONSE",
         "timings": {
           "start": 1642500094940,
           "socket": 1642500094942,
           "lookup": 1642500094986,
           "connect": 1642500095023,
           "secureConnect": 1642500095062,
           "upload": 1642500095063,
           "response": 1642500095130,
           "end": 1642500095133,
           "phases": {
             "wait": 2,
             "dns": 44,
             "tcp": 37,
             "tls": 39,
             "request": 1,
             "firstByte": 67,
             "download": 3,
             "total": 193
           }
         },
         "message": "Response code 403 (Forbidden)",
         "stack": "HTTPError: Response code 403 (Forbidden)\n    at Request.<anonymous> (/usr/src/app/node_modules/got/dist/source/as-promise/index.js:117:42)\n    at processTicksAndRejections (internal/process/task_queues.js:95:5)",
         "options": {
           "headers": {
             "user-agent": "RenovateBot/31.14.1 (https://github.com/renovatebot/renovate)",
             "accept": "application/vnd.github.machine-man-preview+json",
             "authorization": "***********",
             "accept-encoding": "gzip, deflate, br"
           },
           "url": "https://api.github.com/user",
           "hostType": "github",
           "username": "",
           "password": "",
           "method": "GET",
           "http2": false
         },
         "response": {
           "statusCode": 403,
           "statusMessage": "Forbidden",
           "body": {
             "message": "Resource not accessible by integration",
             "documentation_url": "https://docs.github.com/rest/reference/users#get-the-authenticated-user"
           },
           "headers": {
             "server": "GitHub.com",
             "date": "Tue, 18 Jan 2022 10:01:35 GMT",
             "content-type": "application/json; charset=utf-8",
             "transfer-encoding": "chunked",
             "x-github-media-type": "github.v3; param=machine-man-preview; format=json",
             "x-ratelimit-limit": "5000",
             "x-ratelimit-remaining": "4998",
             "x-ratelimit-reset": "1642503099",
             "x-ratelimit-used": "2",
             "x-ratelimit-resource": "core",
             "access-control-expose-headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
             "access-control-allow-origin": "*",
             "strict-transport-security": "max-age=31536000; includeSubdomains; preload",
             "x-frame-options": "deny",
             "x-content-type-options": "nosniff",
             "x-xss-protection": "0",
             "referrer-policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
             "content-security-policy": "default-src 'none'",
             "vary": "Accept-Encoding, Accept, X-Requested-With",
             "content-encoding": "gzip",
             "x-github-request-id": "0780:1478:22C8230:40B7B6B:61E68FFF",
             "connection": "close"
           },
           "httpVersion": "1.1"
         }
       }
DEBUG: Error authenticating with GitHub
       "err": {
         "message": "integration-unauthorized",
         "stack": "Error: integration-unauthorized\n    at handleGotError (/usr/src/app/node_modules/renovate/lib/util/http/github.ts:105:11)\n    at GithubHttp.request (/usr/src/app/node_modules/renovate/lib/util/http/github.ts:254:7)\n    at processTicksAndRejections (internal/process/task_queues.js:95:5)\n    at GithubHttp.requestJson (/usr/src/app/node_modules/renovate/lib/util/http/index.ts:233:17)\n    at getUserDetails (/usr/src/app/node_modules/renovate/lib/platform/github/user.ts:22:7)\n    at Proxy.initPlatform (/usr/src/app/node_modules/renovate/lib/platform/github/index.ts:125:19)\n    at initPlatform (/usr/src/app/node_modules/renovate/lib/platform/index.ts:45:24)\n    at globalInitialize (/usr/src/app/node_modules/renovate/lib/workers/global/initialize.ts:50:12)\n    at Object.start (/usr/src/app/node_modules/renovate/lib/workers/global/index.ts:93:14)\n    at /usr/src/app/node_modules/renovate/lib/renovate.ts:16:22"
       }
FATAL: Authentication failure
DEBUG: Renovate exiting
 INFO: Renovate is exiting with a non-zero code due to the following logged errors
       "loggerErrors": [
         {
           "name": "renovate",
           "level": 60,
           "logContext": "S-qUSZ-dHuGFgOu6h_gOh",
           "msg": "Authentication failure"
         }
       ]
Error: The process '/usr/bin/docker' failed with exit code 1
    at ExecState._setResult (/home/runner/work/_actions/renovatebot/github-action/v31.14.1/dist/index.js:1307:25)
    at ExecState.CheckComplete (/home/runner/work/_actions/renovatebot/github-action/v31.14.1/dist/index.js:1290:18)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/renovatebot/github-action/v31.14.1/dist/index.js:1184:27)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
Error: The process '/usr/bin/docker' failed with exit code 1
rarkins commented 2 years ago

Looks like you didn't configure username. Please checks the docs

ckstevenson commented 2 years ago

Oh no! You are correct. Thanks for the speedy response!