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

Handle node-fetch text parse error #439

Closed
upperwalker opened this issue Mar 15, 2023 · 0 comments
Closed

Handle node-fetch text parse error #439

upperwalker opened this issue Mar 15, 2023 · 0 comments

Comments

@upperwalker
Copy link
Contributor

upperwalker commented Mar 15, 2023

Hi,

Was investigating issue which caused our application to crash from time to time.
It turned out that CT SDK client can produce Unhandled promise rejection when parsing response text.

Steps to reproduce:
Executed 50-100 parallel requests to fetch order by id in endless loop, error pops up randomly within first 1-3 minutes:

  • Error: Invalid response body while trying to fetch ...: read ECONNRESET

Also we've noticed that it can cause similar error, which could be related to this issue:

  • Error: Invalid response body while trying to fetch ...: Premature close

Current behaviour:
fetchFunction is calling res.text().then() without .catch() or finally() blocks

Proposal:
I created a PR proposing a fix to this issue, which adds error handling.

Thank you!

@ajimae ajimae closed this as completed Mar 22, 2023
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

2 participants