Node-Fetch Slow When Using Proxy #459
Labels
area:task-runner
Related to Nebula's Task Runner package
focus:checkout
things involving site checkout (for task runner
focus:monitor
things involving site monitoring
focus:parsing
things involving site parsing (for task runner)
priority:urgent
Issues that need to be solved right away
tag:user-feedback
Issues that are related to user feedback
type:bug
Something isn't working
Describe the bug
There have been several reports from users that claimed that node-fetch is really slow when operating behind a proxy. It's fine when using localhost, but it gets laggy when connected to any proxy requiring a TCP connection.
I looked into this and I believe it stems from the HttpsProxyAgent I was using to connect to the proxy. Node fetch by default sets
keep-alive
to true, but HttpsProxyAgent overrides this when connected to a proxy. This causes thekeep-alive
to be false, which in turn causes a need for the fetch package to reinitialize the TCP connection every time it calls a request.To Reproduce
Steps to reproduce the behavior:
I'd list these here, but it's pretty unnecessary imho.
Expected behavior
We should only receive latency when connecting to a proxy that stems from the actual connection the first time and not the re-initialization of the connection every time a request is made.
Screenshots
N/A
Desktop (please complete the following information):
Additional context
I'm in favor of switching to axios. It has a similar API and native proxy support that doesn't override the
keep-alive
header. Any other suggestions, please post them in the comments below!The text was updated successfully, but these errors were encountered: