bun
bun copied to clipboard
Attempted to assign to readonly property with external package
What version of Bun is running?
1.0.24+6fa35839c
What platform is your computer?
Darwin 23.2.0 arm64 arm
What steps can reproduce the bug?
- Start a clean Bun project
- Setup the following code (including installing Ably package through npm)
import Ably from "ably";
const ably = new Ably.Rest({ key: "key:key" });
ably.auth.requestToken({}, (err, res) => {
console.log(err, res);
});
What is the expected behavior?
The code should complain about wrong authentication or correctly process the request
What do you see instead?
15:08:38.596 Ably: Auth.requestToken(): token request API call returned error; err = RequestError: Attempted to assign to readonly property.
ABLY FAILED
1122 | var Utils = tslib_1.__importStar(__webpack_require__(2));
1123 | function toString(err) {
1124 | var result = '[' + err.constructor.name;
1125 | if (err.message)
1126 | result += ': ' + err.message;
1127 | if (err.statusCode)
^
error: RequestError: Attempted to assign to readonly property.
Additional information
I set up a reproduction repo here: https://github.com/titivermeesch/bun-ably-error-reproduction
The script npm run run-bun fails, but when using npm run run-node it works as expected. The first one uses bun and the second one uses Node v20.11.0)
Possibly related to #8258
Related ably code: https://github.com/ably/ably-js/blob/3336b660407479ccec671da0601775309dc4cfd1/src/common/lib/types/errorinfo.ts#L13
Issue in Bun only having a getter: https://github.com/oven-sh/bun/issues/3150#issuecomment-1698134905 Related PR fix: https://github.com/oven-sh/bun/pull/8368