Skip to content

Clone fails on Node: global.fetch is not a function #938

@strogonoff

Description

@strogonoff

From a quick scan, it looks like as of this change in January 2019 http module no longer checks for global.fetch, which excludes Node environment.

I was accidentally stuck on 0.50 version, and once I updated (for the sake of fastCheckout and other niceties) I’m getting the following stack trace when cloning:

  16:00:17.707 › UnhandledRejection TypeError: global.fetch is not a function
      at http (webpack-internal:///./node_modules/isomorphic-git/dist/for-future/isomorphic-git/index.js:4931:28)
      at Function.discover (webpack-internal:///./node_modules/isomorphic-git/dist/for-future/isomorphic-git/index.js:5162:21)
      at fetchPackfile (webpack-internal:///./node_modules/isomorphic-git/dist/for-future/isomorphic-git/index.js:5975:42)
      at fetch (webpack-internal:///./node_modules/isomorphic-git/dist/for-future/isomorphic-git/index.js:5840:22)
      at Module.clone (webpack-internal:///./node_modules/isomorphic-git/dist/for-future/isomorphic-git/index.js:6321:42)

From cursory search, it seems like global.fetch isn’t supposed to be available on Node. Is reinstating the previous Node-compatible state of http’s fetching logic on the table?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions