[BUG]: octokit.rest.repos.downloadZipballArchive fails with unexpected 500 HTTP error
What happened?
Using ocotokit.reset.repos.downloadZipballArchive often fails with a 500 HTTP error on Linux.
I use this api in libsdl-org/setup-sdl here.
In this action workflow, the libsdl-org/setup-sdl action is used on 3 platforms (macos, Window and Linux).
It succeeds on Windows and macOS, but always fails on Linux.
Versions
@octokit/rest 21.0.1 octokit 3.2.1 node 20.13.1
Relevant log output
https://github.com/madebr/librw/actions/runs/10423418847/job/28870081646#step:5:1153
2024-08-16T16:55:09.0997439Z ##[group]Downloading and extracting libsdl-org/SDL (ba2f78a0069118a6c583f1fbf1420144ffa35bad) into /tmp/setupsdl/a0bcf6a829b2a1d3c4ab2a74ca24b902d29fbd8f62094685d963197bee25a0d5/source
2024-08-16T16:55:09.0999498Z Downloading git zip archive...
2024-08-16T16:55:09.1091030Z GET /repos/libsdl-org/SDL/zipball/ba2f78a0069118a6c583f1fbf1420144ffa35bad - 500 with id UNKNOWN in 9ms
2024-08-16T16:55:09.1092873Z ##[endgroup]
2024-08-16T16:55:09.1121756Z /home/runner/work/_actions/libsdl-org/setup-sdl/main/packed/index.js:78534
2024-08-16T16:55:09.1122872Z const requestError = new RequestError(message, 500, {
2024-08-16T16:55:09.1123741Z ^
2024-08-16T16:55:09.1124192Z
2024-08-16T16:55:09.1124461Z RequestError [HttpError]: other side closed
2024-08-16T16:55:09.1125830Z at fetchWrapper (/home/runner/work/_actions/libsdl-org/setup-sdl/main/packed/index.js:78534:26) {
2024-08-16T16:55:09.1126957Z status: 500,
2024-08-16T16:55:09.1127491Z request: {
2024-08-16T16:55:09.1128045Z method: 'GET',
2024-08-16T16:55:09.1129260Z url: 'https://api.github.com/repos/libsdl-org/SDL/zipball/ba2f78a0069118a6c583f1fbf1420144ffa35bad',
2024-08-16T16:55:09.1130432Z headers: {
2024-08-16T16:55:09.1131058Z accept: 'application/vnd.github.v3+json',
2024-08-16T16:55:09.1132956Z 'user-agent': 'octokit-rest.js/21.0.1 octokit-core.js/6.1.2 Node.js/20.13.1 (linux; x64)',
2024-08-16T16:55:09.1133906Z authorization: 'token [REDACTED]'
2024-08-16T16:55:09.1134290Z },
2024-08-16T16:55:09.1134766Z request: { hook: [Function: bound bound register] }
2024-08-16T16:55:09.1135245Z },
2024-08-16T16:55:09.1135538Z response: undefined,
2024-08-16T16:55:09.1135996Z cause: TypeError: fetch failed
2024-08-16T16:55:09.1136445Z at node:internal/deps/undici/undici:12502:13
2024-08-16T16:55:09.1137256Z at async fetchWrapper (/home/runner/work/_actions/libsdl-org/setup-sdl/main/packed/index.js:78508:21) {
2024-08-16T16:55:09.1138077Z [cause]: SocketError: other side closed
2024-08-16T16:55:09.1138896Z at TLSSocket.onSocketEnd (/home/runner/work/_actions/libsdl-org/setup-sdl/main/packed/index.js:48893:22)
2024-08-16T16:55:09.1139912Z at TLSSocket.emit (node:events:531:35)
2024-08-16T16:55:09.1140900Z at endReadableNT (node:internal/streams/readable:1696:12)
2024-08-16T16:55:09.1142067Z at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
2024-08-16T16:55:09.1143407Z code: 'UND_ERR_SOCKET',
2024-08-16T16:55:09.1143968Z socket: {
2024-08-16T16:55:09.1144552Z localAddress: '10.1.0.10',
2024-08-16T16:55:09.1145300Z localPort: 39244,
2024-08-16T16:55:09.1145919Z remoteAddress: '140.82.113.6',
2024-08-16T16:55:09.1146560Z remotePort: 443,
2024-08-16T16:55:09.1147287Z remoteFamily: 'IPv4',
2024-08-16T16:55:09.1147842Z timeout: undefined,
2024-08-16T16:55:09.1148444Z bytesWritten: 1152,
2024-08-16T16:55:09.1149122Z bytesRead: 6213
2024-08-16T16:55:09.1149594Z }
2024-08-16T16:55:09.1150016Z }
2024-08-16T16:55:09.1150410Z }
2024-08-16T16:55:09.1150911Z }
2024-08-16T16:55:09.1151124Z
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀
Unfortunately that error doesn't give any information... All it says is that the socket was closed unexpectedly
I would suggest using streams instead, see example here: https://github.com/octokit/rest.js/issues/12#issuecomment-1916023479
It shouldn't matter what platform it's running on at least for this kind of code. I can't help you on that one
Thanks for the suggestion. I applied it to my setup-sdl fork, but alas the error remains the same. Perhaps you're seeing a flaw in my implementation? I'm a relative typescript noob.
I have no idea why you're getting HTTP 500 errors only on Linux
I have no idea why you're getting HTTP 500 errors only on Linux
It's very weird. We're using this github action in other SDL repos, such as SDL_image without issue. recent job I created a test repo madebr/setup-sdl-test to test the SDL action. It succeeds when using a fedora docker container, but fails when using a ubuntu docker container.
I'm also seeing this error when making a repos.getContent call:
const file = await octokit.rest.repos.getContent({
owner,
repo,
ref,
path,
mediaType: { format: "raw" },
});
RequestError [HttpError]: other side closed
at /usr/src/app/node_modules/@octokit/request/dist-node/index.js:157:11 {
status: 500,
request: {
method: 'GET',
url: [REDACTED],
headers: {
accept: 'application/vnd.github.v3.raw',
'user-agent': 'octokit-rest.js/20.1.1 octokit-core.js/5.2.0 Node.js/23',
authorization: 'token [REDACTED]'
},
request: { hook: [Function: bound bound register] }
}
}
This is running inside the node:slim image inside an EKS cluster.