oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73k stars 2.66k forks source link

crash using lib ssh2-sftp-client : "missing symbol called" #8228

Closed nanocom closed 4 weeks ago

nanocom commented 7 months ago

What version of Bun is running?

1.0.23

What platform is your computer?

Darwin 23.2.0 arm64 arm

What steps can reproduce the bug?

bun run

import SftpClient from 'ssh2-sftp-client'
console.log('Hello world')
async function b() {
  const client: SftpClient = new SftpClient()
  try {
    await client.connect('ddd')

    const buffer = await client.get('ddd')

    console.log(buffer.toString('utf-8'))
  } finally {
    client.end()
  }
}
b()

What is the expected behavior?

No error message

What do you see instead?

with just the code above =>

dyld[46751]: missing symbol called
[1]    46751 killed     bun run ddd.ts

with the code inside a nestjs app launched with bun --bun start:dev =>

dyld[43856]: missing symbol called
57 |                 killProcess(childProcessRef.pid);
58 |             }
59 |             else {
60 |                 childProcessRef = this.spawnChildProcess(entryFile, sourceRoot, debugFlag, outDirName, binaryToRun);
61 |                 childProcessRef.on('exit', (code) => {
62 |                     process.exitCode = code;
                         ^
TypeError: exitCode must be a number
      at /Users/nanocom/aura/api/node_modules/@nestjs/cli/actions/start.action.js:62:21
      at emit (node:events:154:95)
      at #handleOnExit (node:child_process:537:31)
54 |     find(pid);
55 |     return result;
56 | }
57 | function killPid(pid, signal) {
58 |     try {
59 |         process.kill(pid, signal);
             ^
SystemError: kill() failed
   errno: 3
 syscall: "kill"

      at killPid (/Users/nanocom/aura/api/node_modules/@nestjs/cli/lib/utils/tree-kill.js:59:9)
      at treeKillSync (/Users/nanocom/aura/api/node_modules/@nestjs/cli/lib/utils/tree-kill.js:14:5)
error: script "start:dev" exited with code 1

Additional information

No response

Brown000 commented 6 months ago

Same issue for bun v1.0.28 inited project when using ssh2. As I am using macOS 14 M1 Pro chip, I tried same code on this CodeSandBox project, and that worked. So this is maybe a problem related to the OS.

jdgriffith commented 5 months ago

I believe one of the projects I work on is encountering the exact same thing related to this package on MacOS. This blocks our team from using bun because everyone has a mac. Any chance the underlying issue will be investigated some more? I know it might not be a bun issue but I'm really pushing to get our enterprise team fully on bun with nestjs.

bjesuiter commented 4 months ago

Same error on M3 Max MacBookPro 2023, with Bun 1.1.3

Jarred-Sumner commented 4 weeks ago

Duplicate of #4290

Jarred-Sumner commented 4 weeks ago

@190n is actively working on supporting V8 C++ APIs in Bun

Please follow along in #4290. It will be fixed