Gathering detailed insights and metrics for @vercel/fetch-retry
Gathering detailed insights and metrics for @vercel/fetch-retry
Gathering detailed insights and metrics for @vercel/fetch-retry
Gathering detailed insights and metrics for @vercel/fetch-retry
Opinionated `fetch` (with retrying and DNS caching) optimized for use with Node.js
npm install @vercel/fetch-retry
Typescript
Module System
JavaScript (99.68%)
Shell (0.32%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
573 Stars
201 Commits
26 Forks
61 Watchers
1 Branches
97 Contributors
Updated on Apr 02, 2025
Latest Version
5.1.3
Package Id
@vercel/fetch-retry@5.1.3
Unpacked Size
12.39 kB
Size
4.23 kB
File Count
8
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
1
3
A layer on top of fetch
(via node-fetch)
with sensible defaults for retrying to prevent common errors.
fetch-retry
is a drop-in replacement for fetch
:
1const fetch = require('@vercel/fetch-retry')(require('node-fetch')) 2 3module.exports = async () => { 4 const res = await fetch('http://localhost:3000') 5 console.log(res.status); 6}
Make sure to yarn add @vercel/fetch-retry
in your main package.
Note that you can pass retry options to using opts.retry
.
We also provide a opts.onRetry
and opts.retry.maxRetryAfter
options.
opts.onRetry
is a customized version of opts.retry.onRetry
and passes
not only the error
object in each retry but also the current opts
object.
opts.retry.maxRetryAfter
is the max wait time according to the Retry-After
header.
If it exceeds the option value, stop retrying and returns the error response. It defaults to 20
.
Some errors are very common in production (like the underlying Socket
yielding ECONNRESET
), and can easily and instantly be remediated
by retrying.
The default behavior of fetch-retry
is to attempt retries 10, 60
360, 2160 and 12960 milliseconds (a total of 5 retries) after
a network error, 429 or 5xx error occur.
The idea is to provide a sensible default: most applications should continue to perform correctly with a worst case scenario of a given request having an additional 15550ms overhead.
On the other hand, most applications that use fetch-retry
instead of
vanilla fetch
should see lower rates of common errors and fewer 'glitches'
in production.
To run rests, execute
1npm test
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
Found 8/15 approved changesets -- score normalized to 5
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
12 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More