Skip to content

Invalid "agent" request property when retrying request #478

@krzysztof-grzybek

Description

@krzysztof-grzybek

Describe the bug

When using DefaultRequestExecutor with HTTPS_PROXY env variable being set, retrying request fails with error The "options.agent" property must be one of Agent-like Object, undefined, or false. Received an instance of Object, which is coming from node http(s) library.

The cause.

  1. We're setting "agent" to an object of type HttpsProxyAgent - https://github.com/okta/okta-sdk-nodejs/blob/master/src/http.js#L64
  2. When retrying request, we deepCopy previous request - https://github.com/okta/okta-sdk-nodejs/blob/master/src/default-request-executor.js#L36
  3. After deep copying object, "agent" is no longer an instance of HttpsProxyAgent, and that's the cause why node http(s) library throws an error.

Reproduction Steps?

  1. Run library with HTTPS_PROXY being set.
  2. Trigger request retry (e.g. API limit error)
  3. Error The "options.agent" property must be one of Agent-like Object, undefined, or false. Received an instance of Object is thrown.

SDK Versions

7.0.1

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions