HTTP/1.1 401 Unauthorized
Server: GitHub.com
Date: Wed, 28 Sep 2022 16:02:23 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 152
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-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
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 55
X-RateLimit-Reset: 1664384459
X-RateLimit-Resource: core
X-RateLimit-Used: 5
X-GitHub-Request-Id: F68E:1A6C:47DAE65:925FC3C:63347011
connection: close
{"message":"Requires authentication","documentation_url":"https://docs.github.com/rest/reference/users#list-email-addresses-for-the-authenticated-user"}
Bug Description
When requesting certain endpoints of the GitHub API,
undicicrashes withSocketError: closedFull Error
I'm assuming there's a certain header or combination of response headers that's causing this behavior, but I don't know enough about the Undici codebase or http headers to flag the problem. I've copied the full raw response this endpoint gives using other API debugging tools
Response headers from aforementioned endpoint
Reproducible By
on the latest version at time of writing
5.10.0.Minimal repro repo: https://github.com/rijkvanzanten/undici-socket-err
Expected Behavior
The above code snippet should console.log the JSON output of the endpoint.
Environment
macOS 12.6, Node v16.17.0