Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tncbbthositg opened this issue Nov 10, 2023 · 2 comments

Comments

@tncbbthositg
Copy link

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

#146

d0a717a#diff-ba33178d8ede802f8f6d6c65b2f3806d2a5f194e62ea06d55096b4325cbcf710R23-R28

Environment

Node.js v18.16.1
darwin 22.4.0
9.5.1
@Aiosa
Copy link

Aiosa commented Jan 18, 2024

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

@monarchwadia
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants