Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Invalid status code '404' for url 'https://api.github.com/repos/<user>/<repo>' #76

Open
DatStorm opened this issue Jan 5, 2021 · 9 comments

Comments

@DatStorm
Copy link

DatStorm commented Jan 5, 2021

Hey

I have some problems using push actions. First, no push would happen because of not pulled beforehand but found the solution to that. Now it can not access the GitHub API. I have set the GitHub token and everything. The Repo is private.

Error: Invalid status code '404' for url 'https://api.github.com/repos/<USER>/<REPO>'
    at IncomingMessage.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:14:21)
    at IncomingMessage.emit (events.js:215:7)
    at endReadableNT (_stream_readable.js:1184:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  res: IncomingMessage {
    _readableState: ReadableState {
      objectMode: false,
      highWaterMark: 16384,
      buffer: BufferList { head: null, tail: null, length: 0 },
      length: 0,
      pipes: null,
      pipesCount: 0,
      flowing: true,
      ended: true,
      endEmitted: true,
      reading: false,
      sync: true,
      needReadable: false,
      emittedReadable: false,
      readableListening: false,
      resumeScheduled: false,
      paused: false,
      emitClose: true,
      autoDestroy: false,
      destroyed: false,
      defaultEncoding: 'utf8',
      awaitDrain: 0,
      readingMore: true,
      decoder: null,
      encoding: null
    },
    readable: false,
    _events: [Object: null prototype] { end: [Array], data: [Function] },
    _eventsCount: 2,
    _maxListeners: undefined,
    socket: TLSSocket {
      _tlsOptions: [Object],
      _secureEstablished: true,
      _securePending: false,
      _newSessionPending: false,
      _controlReleased: true,
      _SNICallback: null,
      servername: 'api.github.com',
      alpnProtocol: false,
      authorized: true,
      authorizationError: null,
      encrypted: true,
      _events: [Object: null prototype],
      _eventsCount: 9,
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'api.github.com',
      _readableState: [ReadableState],
      readable: true,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: undefined,
      _server: null,
      ssl: [TLSWrap],
      _requestCert: true,
      _rejectUnauthorized: true,
      parser: null,
      _httpMessage: [ClientRequest],
      [Symbol(res)]: [TLSWrap],
      [Symbol(asyncId)]: 3,
      [Symbol(kHandle)]: [TLSWrap],
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(connect-options)]: [Object]
    },
    connection: TLSSocket {
      _tlsOptions: [Object],
      _secureEstablished: true,
      _securePending: false,
      _newSessionPending: false,
      _controlReleased: true,
      _SNICallback: null,
      servername: 'api.github.com',
      alpnProtocol: false,
      authorized: true,
      authorizationError: null,
      encrypted: true,
      _events: [Object: null prototype],
      _eventsCount: 9,
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'api.github.com',
      _readableState: [ReadableState],
      readable: true,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: undefined,
      _server: null,
      ssl: [TLSWrap],
      _requestCert: true,
      _rejectUnauthorized: true,
      parser: null,
      _httpMessage: [ClientRequest],
      [Symbol(res)]: [TLSWrap],
      [Symbol(asyncId)]: 3,
      [Symbol(kHandle)]: [TLSWrap],
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(connect-options)]: [Object]
    },
    httpVersionMajor: 1,
    httpVersionMinor: 1,
    httpVersion: '1.1',
    complete: true,
    headers: {
      server: 'GitHub.com',
      date: 'Tue, 05 Jan 2021 06:13:21 GMT',
      'content-type': 'application/json; charset=utf-8',
      status: '404 Not Found',
      'x-github-media-type': 'github.v3; format=json',
      'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, 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': '1; mode=block',
      'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
      'content-security-policy': "default-src 'none'",
      vary: 'Accept-Encoding, Accept, X-Requested-With',
      'x-ratelimit-limit': '60',
      'x-ratelimit-remaining': '59',
      'x-ratelimit-reset': '1609830801',
      'x-ratelimit-used': '1',
      'content-length': '107',
      connection: 'close',
      'x-github-request-id': '07C0:70A3:5627175:C8346CC:5FF40381'
    },
    rawHeaders: [
      'server',
      'GitHub.com',
      'date',
      'Tue, 05 Jan 2021 06:13:21 GMT',
      'content-type',
      'application/json; charset=utf-8',
      'status',
      '404 Not Found',
      'x-github-media-type',
      'github.v3; format=json',
      'access-control-expose-headers',
      'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, 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',
      '1; mode=block',
      'referrer-policy',
      'origin-when-cross-origin, strict-origin-when-cross-origin',
      'content-security-policy',
      "default-src 'none'",
      'vary',
      'Accept-Encoding, Accept, X-Requested-With',
      'X-Ratelimit-Limit',
      '60',
      'X-Ratelimit-Remaining',
      '59',
      'X-Ratelimit-Reset',
      '1609830801',
      'X-Ratelimit-Used',
      '1',
      'Content-Length',
      '107',
      'Connection',
      'close',
      'X-GitHub-Request-Id',
      '07C0:70A3:5627175:C8346CC:5FF40381'
    ],
    trailers: {},
    rawTrailers: [],
    aborted: false,
    upgrade: false,
    url: '',
    method: null,
    statusCode: 404,
    statusMessage: 'Not Found',
    client: TLSSocket {
      _tlsOptions: [Object],
      _secureEstablished: true,
      _securePending: false,
      _newSessionPending: false,
      _controlReleased: true,
      _SNICallback: null,
      servername: 'api.github.com',
      alpnProtocol: false,
      authorized: true,
      authorizationError: null,
      encrypted: true,
      _events: [Object: null prototype],
      _eventsCount: 9,
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'api.github.com',
      _readableState: [ReadableState],
      readable: true,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: undefined,
      _server: null,
      ssl: [TLSWrap],
      _requestCert: true,
      _rejectUnauthorized: true,
      parser: null,
      _httpMessage: [ClientRequest],
      [Symbol(res)]: [TLSWrap],
      [Symbol(asyncId)]: 3,
      [Symbol(kHandle)]: [TLSWrap],
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(connect-options)]: [Object]
    },
    _consuming: false,
    _dumped: false,
    req: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      useChunkedEncodingByDefault: false,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: 0,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      socket: [TLSSocket],
      connection: [TLSSocket],
      _header: 'GET /repos/DatStorm/crossfit-wod HTTP/1.1\r\n' +
        'User-Agent: github.com/ad-m/github-push-action\r\n' +
        'Host: api.github.com\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      method: 'GET',
      path: '/repos/DatStorm/crossfit-wod',
      _ended: true,
      res: [Circular],
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      [Symbol(kNeedDrain)]: false,
      [Symbol(isCorked)]: false,
      [Symbol(kOutHeaders)]: [Object: null prototype]
    }
  },
  body: '{"message":"Not Found","documentation_url":"https://docs.github.com/rest/reference/repos#get-a-repository"}'
}
Error: Invalid status code '404' for url 'https://api.github.com/repos/<USER>/<REPO>'
    at IncomingMessage.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:14:21)
    at IncomingMessage.emit (events.js:215:7)
    at endReadableNT (_stream_readable.js:1184:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
@Lyken17
Copy link

Lyken17 commented Jan 5, 2021

Same issue on my projects. Is there any breaking change on Github api?

@Lyken17
Copy link

Lyken17 commented Jan 5, 2021

@DatStorm
Copy link
Author

DatStorm commented Jan 5, 2021

Yeah I have already made the switch to @v2 so it does not fix the problem for me.

@hadasarik
Copy link

Try using the older version: ad-m/[email protected]

@sbalci
Copy link

sbalci commented Jan 5, 2021

Try using the older version: ad-m/[email protected]

did not work for me

@ad-m
Copy link
Owner

ad-m commented Jan 5, 2021

Already discussed in #68. Thank for you detailed report. I will take look on that in few hours. I believe authorization is perfomed in wrong way.

As workaround I suggest add branch: master or branch: main in workflow.

@sbalci
Copy link

sbalci commented Jan 5, 2021

with:
  branch: main

solves the problem as you suggested. Thank you for your time.

@ad-m
Copy link
Owner

ad-m commented Jan 17, 2021

I believe it was fixed in latest master code. Could somebody confirm?

@qops1981
Copy link

Just ran in to this issue. It still requires the branch declaration in the "with" segment to restore functionality.

elileka added a commit to elileka/personal_website that referenced this issue Jan 17, 2023
Trying to add a solution from here ad-m/github-push-action#76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants