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

Multiple errors when using the programming Interface #12

Closed
unixfox opened this issue Feb 14, 2020 · 1 comment
Closed

Multiple errors when using the programming Interface #12

unixfox opened this issue Feb 14, 2020 · 1 comment

Comments

@unixfox
Copy link

unixfox commented Feb 14, 2020

NodeJS version: v13.8.0

I'm trying to use the example from the README but it doesn't work.
My first error is:

/tmp/node_modules/node-tcp-proxy/tcp-proxy.js:21
        throw new Error("cannot parse object: " + o);
        ^

Error: cannot parse object: 10080
    at parse (/tmp/node_modules/node-tcp-proxy/tcp-proxy.js:21:15)
    at new TcpProxy (/tmp/node_modules/node-tcp-proxy/tcp-proxy.js:28:25)
    at Object.module.exports.createProxy (/tmp/node_modules/node-tcp-proxy/tcp-proxy.js:7:12)
    at Object.<anonymous> (/tmp/test.js:2:22)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47

Then I change the port 10080 to a string:

var proxy = require("node-tcp-proxy");
var newProxy = proxy.createProxy(8080, "host", "10080");

After that I get a second error:

internal/fs/utils.js:534
    throw new ERR_INVALID_ARG_TYPE(propName, ['string', 'Buffer', 'URL'], path);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
    at Object.openSync (fs.js:449:10)
    at Object.readFileSync (fs.js:359:35)
    at new TcpProxy (/tmp/node_modules/node-tcp-proxy/tcp-proxy.js:40:39)
    at Object.module.exports.createProxy (/tmp/node_modules/node-tcp-proxy/tcp-proxy.js:7:12)
    at Object.<anonymous> (/tmp/test.js:2:22)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
  code: 'ERR_INVALID_ARG_TYPE'
}
@tewarid
Copy link
Owner

tewarid commented Feb 14, 2020

Just realized that these issues have been fixed a while. I've pushed out a new package version to npm. Please update and try. Thank you.

@tewarid tewarid closed this as completed Feb 14, 2020
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