Skip to content

Outdated https-proxy-agent causing issues with apps using http.request #69

@lenaorobei

Description

@lenaorobei

Description

The @adobe/aio-lib-core-networking package currently uses https-proxy-agent version 2.2.4, which is outdated and causing issues in applications that rely on the Node.js http.request function. This version monkey-patches http.request, leading to incorrect behavior when different parameter combinations (e.g., (url, options, callback) or (options, callback)) are used. See launchdarkly/node-server-sdk#233 (comment)

This issue was specifically reproduced when trying to instantiate the LaunchDarkly Node.js SDK (@launchdarkly/node-server-sdk), but could impact any app that uses http.request.

Expected Behaviour

Applications should correctly handle HTTP requests using Node’s http.request in all valid parameter combinations.

Actual Behaviour

The \"listener\" argument must be of type function. Received an instance of Object

Reproduce Scenario (including but not limited to)

Steps to Reproduce

  1. Use @adobe/aio-lib-state (which depends on @adobe/aio-lib-core-networking).
  2. In the app, instantiate the LaunchDarkly Node.js SDK or any other library that makes requests using http.request with the (url, options, callback) signature.
  3. Observe the error when the request is made.

Platform and Version

  • Node.js 18
  • https-proxy-agent version: 2.2.4 (used by @adobe/aio-lib-core-networking)
  • Affected package: @adobe/aio-lib-core-networking (used by @adobe/aio-lib-state)

Sample Code that illustrates the problem

const LaunchDarkly = require('@launchdarkly/node-server-sdk');

const ldClient = LaunchDarkly.init('your-sdk-key');
const context = {
  kind: 'user',
  key: 'example-key'
};

ldClient.once('ready', () => {
  ldClient.variation('your-feature-flag', context, false, (err, showFeature) => {
    if (err) {
      console.error('Error:', err);
    } else {
      console.log('Feature flag result:', showFeature);
    }
  });
});

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions