CyberSource / CyberSource/cybersource-rest-samples-node

TypeError: Class extends value undefined is not a constructor or null

Open
#77 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43
Forks
66
Avg merge
23m
Merged PRs (30d)
2

Description

I could be doing something silly, but when I've imported
import ApiClient from 'cybersource-plugin';
into my nuxt3 application in a .vue page or component I get the below error

which seems to be in the cybersource-rest-client.js file where the Agent class extends http.Agent

TypeError: Class extends value undefined is not a constructor or null
    at node_modules/cybersource-rest-client/node_modules/agent-base/dist/index.js (cybersource-rest-client.js?v=6b63f3c9:2676:36)
    at __require2 (chunk-WGAPYIUP.js?v=6b63f3c9:19:50)
    at node_modules/cybersource-rest-client/node_modules/https-proxy-agent/dist/index.js (cybersource-rest-client.js?v=6b63f3c9:2941:24)
    at __require2 (chunk-WGAPYIUP.js?v=6b63f3c9:19:50)
    at cybersource-rest-client.js?v=6b63f3c9:57284:68
    at node_modules/cybersource-rest-client/src/ApiClient.js (cybersource-rest-client.js?v=6b63f3c9:57291:7)
    at __require2 (chunk-WGAPYIUP.js?v=6b63f3c9:19:50)
    at cybersource-rest-client.js?v=6b63f3c9:161311:35
    at node_modules/cybersource-rest-client/src/index.js (cybersource-rest-client.js?v=6b63f3c9:161313:7)
    at __require2 (chunk-WGAPYIUP.js?v=6b63f3c9:19:50)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Nuxt 3 import in the .vue page or component and follow the stack trace through cybersource-rest-client.js, agent-base, https-proxy-agent, and ApiClient.js. Determine why http.Agent is undefined in this setup; done means the ApiClient import works without the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nuxtjs
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.