grantila / fetch-h2

HTTP/1+2 Fetch API client for Node.js
MIT License
336 stars 16 forks source link

RetryError: ERR_HTTP2_GOAWAY_SESSION #116

Open lewisl9029 opened 2 years ago

lewisl9029 commented 2 years ago

Hi there! Coming from node-fetch for the h2 support. Everything looked great when I first made the swap, but I just noticed that if I leave the app open for a while, subsequent requests will all end up getting this error:

    err: {
      "type": "RetryError",
      "message": "ERR_HTTP2_GOAWAY_SESSION",
      "stack":
          Error: ERR_HTTP2_GOAWAY_SESSION
              at doFetch (C:\Users\Lewis\Develop\reflame\code\agent\node_modules\fetch-h2\dist\lib\fetch-http2.js:56:23)
    }

The only way to recover I've found was to restart the app, which is obviously not great. 😅

I followed the error trace to this line: https://github.com/grantila/fetch-h2/blob/502c7daf37c4e40eba23da392b8cc708ee84b20d/lib/fetch-http2.ts#L137

The comment above says // Retry with new session, but the code itself just throws. Maybe the retry behavior hasn't been implemented yet?

grantila commented 2 years ago

Interesting, it is implemented, but perhaps it retries over the same session which is what the server doesn't want.

Will look into this.