---
title: Bun v1.1.7
description: "Fixes 28 bugs (addressing 11 👍). Glob workspace names in bun install. Asymmetric matcher support in expect.extends() equals. bunx --version. Bugfixes to JSX transpilation, sourcemaps, cross-compilation of standalone executables, bun shell, RegExp, Worker on Windows, and Node.js compatibility improvements."
date: "2024-05-03T14:02:22.545Z"
author: jarred
draft: false
---

> Bun is an incredibly fast JavaScript runtime, bundler, transpiler, and package manager &mdash; all in one.

Bun v1.1.7 is here! This release fixes 28 bugs (addressing 11 👍). Glob workspace names in bun install. Asymmetric matcher support in expect.extends() equals. bunx --version. Bugfixes to JSX transpilation, sourcemaps, cross-compilation of standalone executables, bun shell, RegExp, Worker on Windows, and Node.js compatibility improvements.

{% callout %}
We're hiring [systems engineers](/careers) in San Francisco to build the future of JavaScript!
{% /callout %}

#### Previous releases

- [`v1.1.6`](/blog/bun-v1.1.6) fixes 10 bugs (addressing 512 👍 reactions). We've implemented UDP socket support & `node:dgram`. DataDog and ClickHouseDB now work. We've fixed a regression in `node:http` from v1.1.5. There are also Node.js compatibility improvements and bugfixes.
- [`v1.1.5`](/blog/bun-v1.1.5) fixes 64 bugs (addressing 101 👍). bun build --compile cross-compile standalone JavaScript & TypeScript executables to other platforms. import any file as text via the `type: "text"` import attribute. Introduces a new crash reporter. `package.json` doesn't error with comments or trailing commas. Fixes a bug where `bun run --filter` exited with 0. Fixes a bug in bun install with file: dependencies. Fixes bugs in `node:fs`, `node:tls`, `node:crypto`, `node:readline`, `node:http`, `node:worker_threads`
- [`v1.1.0`](/blog/bun-v1.1) Bundows. Windows support is here!

#### To install Bun:

{% codetabs %}

```sh#curl
$ curl -fsSL https://bun.sh/install | bash
```

```sh#npm
$ npm install -g bun
```

```sh#powershell
$ powershell -c "irm bun.sh/install.ps1|iex"
```

```sh#scoop
$ scoop install bun
```

```sh#brew
$ brew tap oven-sh/bun
$ brew install bun
```

```sh#docker
$ docker pull oven/bun
$ docker run --rm --init --ulimit memlock=-1:-1 oven/bun
```

{% /codetabs %}

#### To upgrade Bun:

```sh
$ bun upgrade
```

## Glob `workspace` names in `bun install`

You can now use advanced glob patterns in `workspaces` in `package.json` to specify which directories to include in a monorepo. For example:

```json
{
  "name": "monorepo",
  "workspaces": ["{app,packages,lib}/**"]
}
```

Previously, we only supported `/*` as a pattern or exact paths in `workspaces`. `workspaces` matching is now powered by [`Bun.Glob`](https://bun.sh/docs/api/glob), so you can use any glob pattern supported by `Bun.Glob`.

Thanks to [@zackradisic](https://github.com/zackradisic) for implementing this feature!

## Asymmetric matcher support in `expect.extends()` equals

You can now use asymmetric matchers within when using `this.equals` inside `expect.extends()` equals. For example:

```js
import { test, expect } from "bun:test";
expect.extend({
  toCustomEqual(actual, expected) {
    return { pass: this.equals(actual, expected) };
  },
});

test("asymmetric matchers", () => {
  expect(1).toCustomEqual(expect.anything());
  expect(1).toCustomEqual(expect.any(Number));
});
```

Previously, this would throw an error. Now, it works as expected.

Thanks to [@anchan828](https://github.com/anchan828) for implementing this feature!

## bunx --version

When you run `bunx --version`, Bun now prints the version number:

```sh
$ bunx --version
1.1.7
```

Previously, `bunx --version` would print the help menu:

```sh
$ bunx --version
Usage: bunx [...flags] <package>[@version] [...flags and arguments]
Execute an npm package executable (CLI), automatically installing into a global shared cache if not installed in node_modules.

Flags:
  --bun      Force the command to run with Bun instead of Node.js

Examples:
  bunx prisma migrate
  bunx prettier foo.js
  bunx --bun vite dev foo.js
```

Thanks to [@Electroid](https://github.com/Electroid) for fixing this!

## WebSocket close code 1015

When a `WebSocket` client connection fails to connect due to a TLS error, the close code is now `1015` instead of `1006`. This is more accurate and helps with debugging.

```js
const ws = new WebSocket("wss://localhost:3000");

ws.on("close", ({ code, reason }) => {
  console.log(code); // 1015
  console.log(reason); // "TLS handshake failed"
});
```

Previously, the close code was `1006`, which is a generic error code.

## Unhandled errors now print the Bun version

When a top-level error is thrown or promise is rejected, Bun now prints the Bun version at the end:

```js
1 | function hi() {
2 |   return 42;
3 | }
4 |
5 | function yo() {
6 |   throw new Error("uh oh!");
            ^
error: uh oh!
      at yo (error.js:6:9)
      at hey (error.js:11:3)
      at error.js:14:1

Bun v1.1.7 (macOS arm64)
```

This is useful when asking people for debugging help because it saves one question: "What version of Bun are you using?"

## Better error message in Bun.build()

{% raw %}

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">In the next version of Bun<br><br>This error message in `bun build` &amp; <a href="https://t.co/pesCwin4Tx">https://t.co/pesCwin4Tx</a>() shows more information, and a bug causing this happen when it shouldn&#39;t has been fixed. <br><br>top: after, bottom: before <a href="https://t.co/tAQZa42JxH">pic.twitter.com/tAQZa42JxH</a></p>&mdash; Bun (@bunjavascript) <a href="https://twitter.com/bunjavascript/status/1786327136854491348?ref_src=twsrc%5Etfw">May 3, 2024</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

{% /raw %}

## Fixed: React "Duplicate key" warning in development

{% raw %}

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">In the next version of Bun<br><br>A transpiler bug causing React to print the &quot;unique &#39;key&#39; prop&quot; warning has been fixed, thanks to <a href="https://twitter.com/JNYBGR?ref_src=twsrc%5Etfw">@JNYBGR</a> <a href="https://t.co/7qvAOJT55E">pic.twitter.com/7qvAOJT55E</a></p>&mdash; Bun (@bunjavascript) <a href="https://twitter.com/bunjavascript/status/1786341472918511855?ref_src=twsrc%5Etfw">May 3, 2024</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

{% /raw %}

## Fixed: hang in Bun Shell `seq`, `basename`, `dirname` with empty output

When `seq`, `basename`, or `dirname` were called with empty output in Bun Shell, it would hang indefinitely due to not closing the output stream. This has been fixed in Bun v1.1.7, thanks to [@RanoIP](https://github.com/RanoIP).

## Fixed: Potential crash on start on Windows

An invalid memory access in the SIMD codepath within the Zig standard library function `std.mem.indexOfScalarPos` could lead to Bun crashing immediately during initialization on Windows. This has been fixed in Bun v1.1.7.

Additionally, we've added an optimization to code which searches for sentinel values in pointers to use the Windows `wcslen` and `strlen` functions where appropriate, instead of a slower handrolled implementation.

Thanks to [@dylan-conway](https://github.com/dylan-conway) for fixing this!

## Fixed: Potential crash after process spawn

A crash that sometimes occurred when a spawned subprocess gets garbage collected before the stdin stream gets collected has been fixed in Bun v1.1.7.

Thanks to [@gvilums](https://github.com/gvilums) for fixing this!

## Fixed: Crash while exiting with Worker

A crash that could occur when Bun exits while a Worker is still running has been fixed in Bun v1.1.7. This crash was caused by threadlocal destructors running for each thread during `std::quick_exit`.

Thanks to [@dylan-conway](https://github.com/dylan-conway) for fixing this!

## Fixed: Crash when reading directories on Windows

When reading directories on Windows, Bun was assuming that the `FILE_DIRECTORY_INFORMATION` struct in the NT API was 8 bytes aligned, [per the Windows API documentation](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_file_directory_information#remarks). However, runtime safety checks proved this to be false. We have relaxed the alignment requirement for this struct in our code and this crash should no longer occur.

## Fixed: Crash when out of memory on Windows

When the `mimalloc` memory allocator returned `NULL` due to running out of memory, Bun would crash due to an assertion failure like `mimalloc: allocated size is too small`. This assertion failure was only meant for development and testing, not for a release build (we enable assertions by default on Windows however).

This has been fixed in Bun v1.1.7.

This could most easily be reproduced by uploading a large file to a Bun.serve() server when the system was very low on memory or simulating low memory.

## Fixed: Crash when WebSocket client has connection error on Windows

A crash that could occur when a `WebSocket` client connection fails to connect on Windows has been fixed. We've added a test to prevent this from regressing in the future.

## Fixed: UDP socket now throws on valid port number

In Bun v1.1.6 (the previous release), we introduced [Bun.udpSocket](https://bun.sh/docs/api/udp) for UDP socket support.

Previously, all port numbers which weren't between 1 and 65535 would be treated as `0`, and a randomly assigned port would be used. Now, `Bun.udpSocket` throws an error if the provided port number is invalid.

Thanks to [@gvilums](https://github.com/gvilums) for fixing this!

## Fixed: Stacktrace with incorrect line numbers

One bug causing stacktraces to sometimes show incorrect line numbers has been fixed in Bun v1.1.7 (note: there could be other bugs causing this issue).

This bug was caused by an uninitialized integer in C++ code. We are adding [`clang-analyzer`](https://clang-analyzer.llvm.org/) to Bun's CI to prevent this from happening again.

## Fixed: sourcemap regression causing hang in `bun build`

A sourcemap regression introduced in Bun v1.1.6 caused bun build to hang indefinitely. This has been fixed in Bun v1.1.7, and we've added an integration test to prevent this from regressing in the future.

Using `bun build --sourcemap=external` on a "hello world" express.js app like this would hang:

```js
const express = require("express");
const app = express();
const port = 3000;

app.get("/", (req, res) => {
  res.send("Hello World!");
});

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`);
});
```

We've added an integration test that ensures output from `bun build --compile --minify` can successfully run a simple express.js app.

## Fixed: Cross-compilation of executables to & from Windows

Cross-compilation <> Windows had a filepath bug where we were assuming if the current platform was Windows or posix to use the file path prefix for that platform, instead of the cross-compilation target's platform. This bug was fixed, thanks to [@gvilums](https://github.com/gvilums).

## Fixed: memory leak regression in unread server-side requests bodies

In Bun v1.0.30 - Bun v1.1.6, unread incoming HTTP request bodies to Bun.serve() were not being cleaned up properly. This also applied to `node:http` servers.

This meant that choosing not to read the incoming request's body could consume memory indefinitely. This has been fixed in Bun v1.1.7, thanks to [@cirospacari](https://github.com/cirospacari), and we've added regression tests to prevent this from happening again.

## Fixed: fs.fdatasync missing `fd` in Error

When an error was thrown in `fs.fdatasync`, the `fd` property was missing from the error object. This has been fixed in Bun v1.1.7, thanks to [@nektro](https://github.com/nektro).

## Fixed: custom inspect exception

When a custom inspect function threw an exception, Bun would return `[native code]`. This was confusing. We wish we could change this to throw an error, but that would be a breaking change. Instead, we've made it print `[custom formatter threw an exception]` instead, which is slightly better but not what we'd prefer. In a future version of Bun, we will change this to throw an error but we do not want your code to potentially randomly break in a minor version update.

## ServerWebSocket micro-optimization

The in-memory size of a `ServerWebSocket` representation in Zig has shrunk from 32 bytes to 24 bytes. You probably won't notice the memory savings, but it might make some functions run faster due to better cache locality.

## console.log with custom inspect fn gets 8% faster

{% raw %}

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">In the next version of Bun<br><br>Using custom inspect functions in console.log/error gets 8% faster <a href="https://t.co/FLUwX0k6wB">pic.twitter.com/FLUwX0k6wB</a></p>&mdash; Jarred Sumner (@jarredsumner) <a href="https://twitter.com/jarredsumner/status/1786334857452519768?ref_src=twsrc%5Etfw">May 3, 2024</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

{% /raw %}

## Thank you to 17 contributors!

- [@anchan828](https://github.com/anchan828)
- [@cirospaciari](https://github.com/cirospaciari)
- [@codershiba](https://github.com/codershiba)
- [@DaleSeo](https://github.com/DaleSeo)
- [@dsernst](https://github.com/dsernst)
- [@dylan-conway](https://github.com/dylan-conway)
- [@Electroid](https://github.com/Electroid)
- [@fzn0x](https://github.com/fzn0x)
- [@gvilums](https://github.com/gvilums)
- [@Jarred-Sumner](https://github.com/Jarred-Sumner)
- [@JonnyBurger](https://github.com/JonnyBurger)
- [@mangs](https://github.com/mangs)
- [@nektro](https://github.com/nektro)
- [@paperclover](https://github.com/paperclover)
- [@RanolP](https://github.com/RanolP)
- [@windwiny](https://github.com/windwiny)
- [@zackradisic](https://github.com/zackradisic)
