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

NextLS.DynamicSupervisor crashes on 403 Github API response #350

Closed
jamesvl opened this issue Dec 21, 2023 · 0 comments · Fixed by #351, #333, #356, #357 or #358
Closed

NextLS.DynamicSupervisor crashes on 403 Github API response #350

jamesvl opened this issue Dec 21, 2023 · 0 comments · Fixed by #351, #333, #356, #357 or #358

Comments

@jamesvl
Copy link
Contributor

jamesvl commented Dec 21, 2023

Problem

When I start my editor (nvim) which in turn starts next-ls, NextLS.DynamicSupervisor terminates when it receives a 403 message for Github. It looks like it's trying to send an API request to Github for the latest version.

For me, it was because this request is not authenticated and I hit Github's API rate limit.

End Goal

If Github is not reachable, down, or returns something other than a 200 response, continue to run with the currently installed version.

Logs

85 [ERROR][2023-12-21 14:16:30] .../vim/lsp/rpc.lua:734    "rpc"   "/home/jamesvl/.cache/elixir-tools/nextls/bin/nextls"   "stderr"        "\n14:16:30.317 [error] Task #PID<0.1      97.0> started from NextLS.DynamicSupervisor terminating
** (CaseClauseError) no case clause matching: {:ok, %Req.Response{status: 403, headers: [{\"date\", \"Thu, 21 Dec 20      23 19:16:30 GMT\"}, {\"server\", \"Varnish\"}, {\"strict-transport-security\", \"max-age=31536000; includeSubdomains; preload\"}, {\"x-content-type-options\", \"nosniff\"},      {\"x-frame-options\", \"deny\"}, {\"x-xss-protection\", \"1; mode=block\"}, {\"content-security-policy\", \"default-src 'none'; style-src 'unsafe-inline'\"}, {\"access-contr      ol-allow-origin\", \"*\"}, {\"access-control-expose-headers\", \"ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset      , X-RateLimit-Used, X-RateLimit-Resource, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset\"}, {\"content-type\", \"applica      tion/json; charset=utf-8\"}, {\"referrer-policy\", \"origin-when-cross-origin, strict-origin-when-cross-origin\"}, {\"x-github-media-type\", \"github.v3; format=json\"}, {\"x-ratelimit-limit\", \"60\"}, {\"x-ratelimit-remaining\", \"0\"}, {\"x-ratelimit-reset\", \"1703188568\"}, {\"x-ratelimit-resource\", \"core\"},
{\"x-ratelimit-used\", \"60\      "}, {\"content-length\", \"279\"}, {\"x-github-request-id\", \"--elided--\"}],

body: %{\"documentation_url\" => \"https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting\", \"message\" => \"API rate limit exceeded for x.x.x.43. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\"}, private: %{}}}
    (next_ls 0.15.0) lib/next_ls/updater.ex:19: NextLS.Updater.run/1
    (elixir 1.15.7) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
Function: &NextLS.Updater.run/1
    Args: [[binpath: \"/home/--elided--/.cache/elixir-tools/nextls/bin/nextls\", api_host: \"https://api.github.com\", github_host: \"https://github.com\", current_version: %Version{major: 0, minor: 15, patch: 0}, logger: #PID<0.195.0>]]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment