-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Bun crashes with dyld[20937]: missing symbol called
while using testcontainers library
#7810
Comments
dyld[20937]: missing symbol called
while using testcontainers library?dyld[20937]: missing symbol called
while using testcontainers library
After investigation, it seems to come from the cpu-features package. |
@AmauryD Have you tried running |
just rm -rf node-module/cpu-features gets me a different error ("error: Could not find a working container runtime strategy") |
i also have the exact same issue. |
Do you think the only option is to implement the cpu-feature package for Bun? |
I raised the This is frustrating because However, this assumes that loading issues would occur in a way that's catchable, that is, a thrown JavaScript error. However, in bun's case, the error seems to coming from something deeper that they potentially don't control (handwaving a bit, probably the OS). I previously asked if there was a way to have Bun turn this issue into a JavaScript error that could be caught: #158 (comment). I never got a reply to that; maybe it's just not possible. |
After toying around with it I've found that there is a way to not install "ssh2" dependency which ends up installing The trick was to
I assume this is due to Here's the sample I ran with const assert = require('node:assert')
import { describe, beforeEach, afterEach, it } from 'bun:test'
// const {
// describe,
// it,
// expect,
// beforeEach,
// afterEach,
// } = require('node:test')
//
const redis = require("async-redis");
const { GenericContainer } = require("testcontainers");
describe("Redis", () => {
let container;
let redisClient;
beforeEach(async () => {
container = await new GenericContainer("redis")
.withExposedPorts(6379)
.start();
redisClient = redis.createClient(
container.getMappedPort(6379),
container.getHost(),
);
});
afterEach(async () => {
await redisClient.quit();
await container.stop();
});
it("works", async () => {
await redisClient.set("key", "val");
assert.strictEqual(
await redisClient.get("key") ,
"val"
)
});
}); |
I experienced the same and was able to get it working with a couple modifications:
Command
|
@JacobReynolds Thanks for sharing your tips. For me the two tips of removing |
For a workaround, use
diff --git a/node_modules/cpu-features/disabled.js b/disabled.js
new file mode 100644
index 0000000000000000000000000000000000000000..4d2d18c14a2f3334ce0227d2b9eabad3cb28e41c
--- /dev/null
+++ b/disabled.js
@@ -0,0 +1 @@
+throw new Error(`cpu-features not available on Bun`)
diff --git a/package.json b/package.json
index 6cc12c3c7703ea17995be61c5accc331e7e35014..da299bcca20a1a0654f6910c19d613ee776be478 100644
--- a/package.json
+++ b/package.json
@@ -3,10 +3,8 @@
"version": "0.0.10",
"author": "Brian White <mscdex@mscdex.net>",
"description": "A simple binding to Google's cpu_features library for obtaining information about installed CPU(s)",
- "main": "./lib/index",
+ "main": "./disabled.js",
"dependencies": {
- "buildcheck": "~0.0.6",
- "nan": "^2.19.0"
},
"devDependencies": {
"@mscdex/eslint-config": "^1.1.0", |
Tracking this in #4290 |
What version of Bun is running?
1.0.19+906f86d6f
What platform is your computer?
Darwin 23.1.0 arm64 arm
What steps can reproduce the bug?
Just run this snippet with bun
What is the expected behavior?
Bun does not crashes
What do you see instead?
Additional information
The library used is : testcontainers-node
Here's a reproduction : https://github.com/AmauryD/bun-test-containers-error
I made a comment in #6311, but i don't know if it is related or not. So i made a separate issue just in case.
The text was updated successfully, but these errors were encountered: