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

Node22 DeprecationWarning due node-fetch 2.x #765

Open
Kurre opened this issue May 8, 2024 · 1 comment
Open

Node22 DeprecationWarning due node-fetch 2.x #765

Kurre opened this issue May 8, 2024 · 1 comment

Comments

@Kurre
Copy link

Kurre commented May 8, 2024

It seems that node-fetch v2.x is causing DeprecationWarning on Node22 (maybe in Node21 too?) due usage of deprecated punycode module. node-fetch 2.x is only receiving security fixes so this issue won't most likely be resolved without upgrading the node-fetch dependency to 3.x.

references from other repos:

edit: simplified example

Expected Behaviour
No warnings

Actual Behaviour

(node:16845) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.

Testcontainer Logs

  testcontainers [DEBUG] Testing container runtime strategy "TestcontainersHostStrategy"... +0ms
  testcontainers [DEBUG] Loading ".testcontainers.properties" file... +1ms
(node:30063) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
  testcontainers [DEBUG] Loaded ".testcontainers.properties" file +3ms
  testcontainers [DEBUG] Found custom configuration: tcHost: "tcp://127.0.0.1:51243", dockerHost: "tcp://127.0.0.1:51243" +0ms
  testcontainers [DEBUG] Container runtime strategy "TestcontainersHostStrategy" does not work +10ms
  testcontainers [DEBUG] Testing container runtime strategy "ConfigurationStrategy"... +0ms
  testcontainers [DEBUG] Container runtime strategy "ConfigurationStrategy" does not work +1ms
  testcontainers [DEBUG] Testing container runtime strategy "UnixSocketStrategy"... +1ms
  testcontainers [DEBUG] Container runtime strategy "UnixSocketStrategy" works +630ms
  testcontainers [DEBUG] Checking if image exists "redis:latest"... +1ms
  testcontainers [DEBUG] Checked if image exists "redis:latest" +32ms
  testcontainers [DEBUG] Pulling image "redis:latest"... +0ms
  testcontainers [DEBUG] Executing Docker credential provider "docker-credential-desktop" +0ms
  testcontainers [DEBUG] Auth config found for registry "https://index.docker.io/v1/": CredsStore +190ms
  testcontainers [DEBUG] Pulled image "redis:latest" +6s
  testcontainers [DEBUG] Acquiring lock file "/var/folders/2m/wv2pzcq1097f3ytr1tz8pz4w0000gn/T/testcontainers-node.lock"... +2ms
  testcontainers [DEBUG] Acquired lock file "/var/folders/2m/wv2pzcq1097f3ytr1tz8pz4w0000gn/T/testcontainers-node.lock" +4ms
  testcontainers [DEBUG] Listing containers... +0ms
  testcontainers [DEBUG] Listed containers +5ms
  testcontainers [DEBUG] Creating new Reaper for session "92ecc678de72" with socket path "/var/run/docker.sock"... +0ms
  testcontainers [DEBUG] Checking if image exists "testcontainers/ryuk:0.5.1"... +0ms
  testcontainers [DEBUG] Checked if image exists "testcontainers/ryuk:0.5.1" +3ms
  testcontainers [DEBUG] Image "testcontainers/ryuk:0.5.1" already exists +0ms
  testcontainers [DEBUG] Creating container for image "testcontainers/ryuk:0.5.1"... +1ms
  testcontainers [DEBUG] [89b6d2e50339] Created container for image "testcontainers/ryuk:0.5.1" +148ms
  testcontainers [INFO] [89b6d2e50339] Starting container for image "testcontainers/ryuk:0.5.1"... +0ms
  testcontainers [DEBUG] [89b6d2e50339] Starting container... +0ms
  testcontainers [DEBUG] [89b6d2e50339] Started container +170ms
  testcontainers [INFO] [89b6d2e50339] Started container for image "testcontainers/ryuk:0.5.1" +0ms
  testcontainers [DEBUG] [89b6d2e50339] Inspecting container... +0ms
  testcontainers [DEBUG] [89b6d2e50339] Inspected container +3ms
  testcontainers [DEBUG] [89b6d2e50339] Waiting for container to be ready... +1ms
  testcontainers [DEBUG] [89b6d2e50339] Waiting for log message "/.+ Started!/"... +0ms
  testcontainers [DEBUG] [89b6d2e50339] Fetching container logs... +0ms
  testcontainers [DEBUG] [89b6d2e50339] Demuxing stream... +3ms
  testcontainers [DEBUG] [89b6d2e50339] Demuxed stream +0ms
  testcontainers [DEBUG] [89b6d2e50339] Fetched container logs +0ms
  testcontainers [DEBUG] [89b6d2e50339] Log wait strategy complete +2ms
  testcontainers [INFO] [89b6d2e50339] Container is ready +1ms
  testcontainers [DEBUG] [89b6d2e50339] Connecting to Reaper (attempt 1) on "localhost:55019"... +0ms
  testcontainers [DEBUG] [89b6d2e50339] Connected to Reaper +2ms
  testcontainers [DEBUG] Releasing lock file "/var/folders/2m/wv2pzcq1097f3ytr1tz8pz4w0000gn/T/testcontainers-node.lock"... +0ms
  testcontainers [DEBUG] Released lock file "/var/folders/2m/wv2pzcq1097f3ytr1tz8pz4w0000gn/T/testcontainers-node.lock" +0ms
  testcontainers [DEBUG] Creating container for image "redis:latest"... +0ms
  testcontainers [DEBUG] [2c0a26b44a6e] Created container for image "redis:latest" +63ms
  testcontainers [INFO] [2c0a26b44a6e] Starting container for image "redis:latest"... +0ms
  testcontainers [DEBUG] [2c0a26b44a6e] Starting container... +0ms
  testcontainers [DEBUG] [2c0a26b44a6e] Started container +188ms
  testcontainers [INFO] [2c0a26b44a6e] Started container for image "redis:latest" +0ms
  testcontainers [DEBUG] [2c0a26b44a6e] Inspecting container... +0ms
  testcontainers [DEBUG] [2c0a26b44a6e] Inspected container +3ms
  testcontainers [DEBUG] [2c0a26b44a6e] Waiting for container to be ready... +0ms
  testcontainers [DEBUG] [2c0a26b44a6e] Waiting for host port 55020... +1ms
  testcontainers [DEBUG] [2c0a26b44a6e] Waiting for internal port 6379... +0ms
  testcontainers [DEBUG] [2c0a26b44a6e] Host port 55020 ready +3ms
  testcontainers [DEBUG] [2c0a26b44a6e] Host port wait strategy complete +0ms
  testcontainers [DEBUG] [2c0a26b44a6e] Internal port 6379 ready +73ms
  testcontainers [INFO] [2c0a26b44a6e] Container is ready +0ms

Steps to Reproduce

import { GenericContainer } from 'testcontainers'

new GenericContainer("redis").withExposedPorts(6379)
	.start().then((container) => console.log(container))

Environment Information

  • Operating System: MacOS Sonoma 14.4.1
  • Docker Version: 26.0
  • Node version: 22.1
  • Testcontainers version: 10.9.0
@Kurre
Copy link
Author

Kurre commented May 8, 2024

I was tinkering a bit with this one, and if the supported Node.js versions are 18, 20 (and 22), then it should be possible to just replace the node-fetch with Node's own fetch implementation.

I made a quick'n'dirty PoC of this variation, and it seems to be a possible way to proceed. Some tests for modules are failing, but probably nothing too serious 🤔

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

1 participant