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

TypeError: ProxyAgent is not a constructor #165

Open
nitsik opened this issue Jan 25, 2024 · 1 comment
Open

TypeError: ProxyAgent is not a constructor #165

nitsik opened this issue Jan 25, 2024 · 1 comment

Comments

@nitsik
Copy link

nitsik commented Jan 25, 2024

I use somthing like this:


// Create a new wrapper object and pass the username
//let tiktokLiveConnection = new WebcastPushConnection(tiktokUsername);

const ProxyAgent = require('proxy-agent');

let tiktokLiveConnection = new WebcastPushConnection('@1223', {
    requestOptions: {
        httpAgent: new ProxyAgent('http://login:[email protected]:123'),
        timeout: 10000 // 10 seconds
    },
    websocketOptions: {
        agent: new ProxyAgent('http://login:[email protected]:123'),
        timeout: 10000 // 10 seconds
    }
});

But I see:

node tiktok.js
/root/tiktok.js:43
        httpAgent: new ProxyAgent('http://login:[email protected]:123'),
                   ^

TypeError: ProxyAgent is not a constructor
    at Object.<anonymous> (/root/tiktok.js:43:20)
    at Module._compile (node:internal/modules/cjs/loader:1255:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1309:10)
    at Module.load (node:internal/modules/cjs/loader:1113:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47

Node.js v20.2.0

Why? Thank you

@yudimanage
Copy link

// Create a new wrapper object and pass the username
//let tiktokLiveConnection = new WebcastPushConnection(tiktokUsername);

const { ProxyAgent } = require('proxy-agent');

let tiktokLiveConnection = new WebcastPushConnection('@1223', {
    requestOptions: {
        httpAgent: new ProxyAgent('http://login:[email protected]:123'),
        timeout: 10000 // 10 seconds
    },
    websocketOptions: {
        agent: new ProxyAgent('http://login:[email protected]:123'),
        timeout: 10000 // 10 seconds
    }
});

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

2 participants