Skip to content

Commit

Permalink
Apply patch-package to fix "Premature close" bug
Browse files Browse the repository at this point in the history
We see that for some fetches of certain lengths after certain amount
of parallelism, we see "Premature close" errors as documented in this
issue: node-fetch/node-fetch#1576

We are applying the suggested fix in this PR:
Treverix/node-fetch@625fd38?diff=split

We do so by using patch-package to path our node-fetch-cjs, an then
inlining a copy of node-fetch-cjs into our built files.
  • Loading branch information
chungwu committed Sep 30, 2023
1 parent c5c8e14 commit 4878aa0
Show file tree
Hide file tree
Showing 7 changed files with 1,034 additions and 14 deletions.
1 change: 1 addition & 0 deletions packages/isomorphic-unfetch/.gitignore
@@ -0,0 +1 @@
dist/
4 changes: 1 addition & 3 deletions packages/isomorphic-unfetch/index.js
@@ -1,7 +1,5 @@
function r(m){return m && m.default || m;}
module.exports = (typeof process == 'undefined'
? global.fetch || r(require('unfetch'))
: function(url, opts) {
return r(require('node-fetch-cjs'))(String(url).replace(/^\/\//g,'https://'), opts);
}
: r(require('./dist/server'))
);

0 comments on commit 4878aa0

Please sign in to comment.