pollyjs icon indicating copy to clipboard operation
pollyjs copied to clipboard

Un-deprecate adapter-fetch for node because the fetch module was added to Node 18

Open tncbbthositg opened this issue 1 year ago • 2 comments

Description

At some point, the assumption was that the fetch global was a polyfill provided by node-fetch and that the node http module would be the lowest level underlying mechanism for making http requests.

This changed as of Node 18 so the deprecation warning is no longer valid:

[Polly] [adapter:fetch] Using the fetch adapter in Node has been deprecated. Please use the node-http adapter instead.

Shareable Source

import * as FetchAdapter from '@pollyjs/adapter-fetch';
Polly.register(FetchAdapter as any);

Error Message & Stack Trace

   [Polly] [adapter:fetch] Using the fetch adapter in Node has been deprecated. Please use the node-http adapter instead.

Config

    polly = new Polly('Recording Name', {
      adapters: ['fetch'],
      persister: 'fs',
    });

Dependencies

{
    "@pollyjs/adapter-fetch": "^6.0.6",
    "@pollyjs/core": "^6.0.6",
    "@pollyjs/persister-fs": "^6.0.6",
}

Relevant Links

https://github.com/Netflix/pollyjs/blob/master/CHANGELOG.md#bug-fixes-32

https://github.com/Netflix/pollyjs/pull/146

https://github.com/Netflix/pollyjs/pull/146/commits/d0a717a6f24fc618b739b143026e1856499154a8#diff-ba33178d8ede802f8f6d6c65b2f3806d2a5f194e62ea06d55096b4325cbcf710R23-R28

Environment

Node.js v18.16.1
darwin 22.4.0
9.5.1

tncbbthositg avatar Nov 10 '23 17:11 tncbbthositg

Same here for node 20.11.0. node-http does not work with native fetch.

Aiosa avatar Jan 18 '24 18:01 Aiosa

Chiming in on the same issue. This is annoying :')

monarchwadia avatar Jun 01 '24 22:06 monarchwadia