-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Closed the Server and app crashed [TypeError [ERR_INVALID_ARG_TYPE]: The "buf" argument must be an instance of Buffer, TypedArray, or DataView. Received null at new NodeError] #247
Comments
me too , UP |
me too |
@sagar-capti nice work. Able to wrap it up into a PR? |
I tried to create PR but showing some permission issue. |
@sagar-capti - Please fork this repo and create a patch in your own. then create a PR. Base will be this repo and the tip will be yours. Thanks! |
@mkozjak - Done Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In version 2.2.2,
When attempt a telnet connection, It show an error as below "error: TypeError [ERR_INVALID_ARG_TYPE]: The "buf" argument must be an instance of Buffer, TypedArray, or DataView. Received null"
and executes the properly. and at the end it Closed the Server
and my app crashed
"nodemon" version: "^2.0.0",
==Here is the Code function==
const getInterfaceMac = async ({ updatedResult }) => {
console.log('updatedResult ==', updatedResult);
const params = {
host: '10.6.234.635',
port: 23,
username: 'demoapi',
password: 'ei38uer47rbjkfq',
shellPrompt: /[#>]\s*$/, // Matches shell prompt
timeout: 30000,
loginPrompt: /User name[: ]$/i,
passwordPrompt: /password[: ]$/i,
debug: true,
};
try {
console.log('Attempting to connect...');
await telnetConnection.connect(params);
console.log('telnetConnection established successfully.');
} catch (error) {
console.error('Error during telnet session:', error);
if (telnetConnection) telnetConnection.end(); // Ensure the telnetConnection is closed on error
throw error;
}
};
process.on('unhandledRejection', (error) => {
console.log('Do something about it: ', error);
throw error;
});
=== ERROR ===
Attempting to connect...
error: TypeError [ERR_INVALID_ARG_TYPE]: The "buf" argument must be an instance of Buffer, TypedArray, or DataView. Received null
at new NodeError (node:internal/errors:405:5)
at StringDecoder.write (node:string_decoder:99:11)
at Telnet.parseData (D:\Projects\test\demo\node_modules\telnet-client\lib\index.js:357:45)
at Socket. ((D:\Projects\test\demo\node_modules\telnet-client\lib\index.js:155:34)
at Socket.emit (node:events:514:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Readable.push (node:internal/streams/readable:234:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
telnetConnection established successfully.
Sending 'enable' command...
Enable command response:
ew07-89log.bne
Sending 'display mac-address port 0/1/0' command...
Response chunk:
ew07-89log.bne#
Final MAC Address response for port 0/1/0:
ew07-89log.bne#
Extracted MAC Addresses for port: []
Sending 'display mac-address port 0/1/1' command...
Response chunk:
ew07-89log.bne#
Extracted MAC Addresses for port: []
telnetConnection closed.
info: GET /v1/demo/get-interface?appid=d581eef5c4c8df589a4e9 200 - 58513.479 ms
info: Server closed
[nodemon] app crashed - waiting for file changes before starting...
The text was updated successfully, but these errors were encountered: