ssh.dispose method throwing error after migrating to node 18
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- node.js, typescript
- Domain
- backend
Research direction
Start by reproducing the provided readFile flow under Node 18 and follow ssh.dispose into the ssh2 stack trace, especially SFTP.js cleanupRequests and ChannelManager.cleanup. Compare the behavior with Node 16 and verify that reading the file still succeeds while disposing the connection completes without the reported error.
Written by the indexing model from the issue text.
Description
Here's abstract code to read a file on SFTP server using node-ssh.
It was working fine till I was using node 16. But the ssh.dispose statement started throwing error after I migrated to node 18.
It is still able to connect with server and read file, but throws error while desposing connection.
It seems upgrade is required on library to make it compatible with node 18. Would you be able to help check.
Thanks in advance for any info / support.
Error :
Error: No response from server at cleanupRequests (node_modules/ssh2/lib/protocol/SFTP.js:2730:15) at SFTP.push (node_modules/ssh2/lib/protocol/SFTP.js:191:7) at onCHANNEL_CLOSE (node_modules/ssh2/lib/utils.js:50:13) at ChannelManager.cleanup (/usr/src/app/node_modules/ssh2/lib/utils.js:200:7)
Code :
import { NodeSSH } from 'node-ssh';
async function readFile(path: string): Promise<string> {
let ssh: NodeSSH | null = null;
try {
const ssh = new NodeSSH()
await ssh.connect({
host, username, password
})
const sftp = await ssh.requestSFTP();
const fstream = sftp.createReadStream(path);
return await convertStreamToString(fstream); // local function to convert stream into a string format using chunks & Buffer
} catch() {
// throw error
} finally {
await ssh?.dispose();
}
}
- Dominant language
- TypeScript
- Stars
- 1k
- Forks
- 94
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from steelbrain/node-ssh
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
steelbrain/node-ssh#487 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
steelbrain/node-ssh#482 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
steelbrain/node-ssh#474 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
steelbrain/node-ssh#473 · 1 comment · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 20/100
steelbrain/node-ssh#472 ·
All issues in steelbrain/node-ssh
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
cli: `execCargoMetadata` decodes stdout per chunk, corrupting non-ASCII paths across pipe boundariesOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 62/100
lingdojo/kana-dojo#34127 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
osmlab/name-suggestion-index#13104 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100