---
title: Bun v1.1.34
description: "Fixes 64 bugs (addressing 62 👍). `Bun.randomUUIDv7`, reduced memory usage for long-running processes, `napi_type_tag_object` and `napi_check_object_type_tag`, redacted secrets from config logs, `ReadableStream` and HTTP/1.1 spec fixes, several `bun install` and Node.js compatibility improvements"
date: "2024-11-02T05:09:22.018Z"
author: dylan
---

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

This release fixes 64 bugs (addressing 62 👍). It introduces `Bun.randomUUIDv7`, reduced memory usage for long-running processes, `napi_type_tag_object` and `napi_check_object_type_tag`, redacted secrets from config logs, `ReadableStream` and HTTP/1.1 spec fixes, and several `bun install` and Node.js compatibility improvements.

#### 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
```

### New: `Bun.randomUUIDv7()`

`Bun.randomUUIDv7()` returns a [UUID v7](https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-01.html#name-uuidv7-layout-and-bit-order), a monotonic UUID suitable for sorting and databases.

```ts#index.ts
import { randomUUIDv7 } from "bun";
const id = randomUUIDv7();
// => "0192ce11-26d5-7dc3-9305-1426de888c5a"
```

### Long-running processes use less memory

While your application sleeps in the event loop, the garbage collector runs and frees more memory. This reduces memory usage for long-running processes.

{% raw %}

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">In the next version of Bun<br><br>Long-lived processes use a little less memory <a href="https://t.co/Q71tY0kU5r">pic.twitter.com/Q71tY0kU5r</a></p>&mdash; Jarred Sumner (@jarredsumner) <a href="https://twitter.com/jarredsumner/status/1851178003486949719?ref_src=twsrc%5Etfw">October 29, 2024</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

{% /raw %}

{% details summary="Sample code" %}

```js#index.js
console.clear();
console.log("Starting...");
const iterationCount = 100000;
globalThis.signals = new Array(iterationCount);
globalThis.requests = new Array(iterationCount);
var total = 0;
setInterval(() => {
  const rss = (process.memoryUsage.rss() / 1024 / 1024) | 0;
  const objectTypeCounts = require("bun:jsc").heapStats().objectTypeCounts;
  console.table({
    "Memory usage MB (RSS)": rss,
    "AbortSignal alive count": objectTypeCounts.AbortSignal || 0,
    "new AbortSignal() calls": total,
    "Uptime (seconds)": Math.floor(process.uptime()),
  });
}, 10000);
while (true) {
  for (let i = 0; i < iterationCount; i++) {
    const req = new Request("https://example.com/");
    requests[i] = req;
    signals[i] = AbortSignal.any([req.signal, new AbortController().signal]);
  }
  total += iterationCount;
  await Bun.sleep(1000);
}
```

{% /details %}

### `napi_type_tag_object` and `napi_check_object_type_tag`

Bun v1.1.34 adds Node-API support for `napi_type_tag_object` and `napi_check_object_type_tag`. These functions allow associating a [type tag](https://nodejs.org/api/n-api.html#napi_type_tag) with objects, and unblocks the [tree-sitter](https://www.npmjs.com/package/tree-sitter) package.

Implemented thanks to [@190n](https://github.com/190n)!

### Redacted secrets in `bunfig.toml` and `.npmrc` logs

Bun will now redact secrets that appear in `bunfig.toml` and `.npmrc` logs for syntax errors or invalid configurations. UUIDs, npm secret tokens, url passwords, and values following `_auth`, `_authToken`, `email`, `_password`, and `token` will be replaced with `*`.

```toml#bunfig.toml
[registry]
a = { b = "http://user:pass@site.org", ; token = "ooops" }
```

```diff
$ bun install
- 2 | a = { b = "http://user:pass@site.org", ; token = "ooops" }
+ 2 | a = { b = "http://user:****@site.org", ; token = "*****" }
                                           ^
error: Unexpected semicolon
    at /path/to/bunfig.toml:2:40

SyntaxError: failed to load bunfig
```

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

### Inline `process.versions.bun` in `bun build --compile`

When you use `bun build --compile`, Bun will now inline usages of `process.versions.bun`.

This means that the following code can be used to statically load node native addons when using `bun build --compile`:

```js
const bindings =
  typeof process.versions.bun === "string"
    ? // `bun build --compile` will bundle the prebuilt .node file into the standalone build
      require(`./preload/${process.platform}-${process.arch}/my-addon.node`) // -> ./preload/linux-x64/my-addon.node
    : // Otherwise, use node-gyp-build to resolve the .node file at runtime
      require("node-gyp-build")(
        path.join(
          __dirname,
          `${process.platform}-${process.arch}`,
          `my-addon.node`,
        ),
      );
```

Thanks to [@youennf](https://github.com/youennf)!

## Bugfixes

### Fixed: ReadableStream spec updates

We've updated our ReadableStream implementation based on WebKit's upstream changes, fixing several spec issues including:

- An error on piped ReadableStream could lead to an unhandled promise rejection
- `pipeThrough` and `pipeTo` promises were not marked as handled
- An error in a `ReadableStream` was rejecting closed promises before erroring read promises
- `ReadableStreamDefaultReader.releaseLock` was rejecting pending read promises

Thanks to [@pfgithub](https://github.com/pfgithub) and @youennf (via WebKit) for the important fixes!

### Fixed: `bun install` failing with `patchedDependencies` and `bin` fields

A bug causing patched dependencies to fail to install when `package.json` also contained a `bin` field has been fixed. Now, both can exist in `package.json` and patches will be applied correctly.

```json#package.json
{
    "name": "pkg",
    "version": "1.0.0",
    "bin": "pkg.js",
    "dependencies": {
        "zod": "3.23.8"
    },
    "patchedDependencies": {
        "zod@3.23.8": "patches/zod@3.23.8.patch"
    }
}
```

Fixed thanks to [@dylan-conway](https://github.com/dylan-conway)!

### Fixed: Migrating `package-lock.json` with dependency on the root package

Given the following `package.json`:

```json#package.json
{
    "name": "root-dep",
    "dependencies": {
        // becomes `./node_modules/root-dep`, a symlink to the root package
        "root-dep": "."
    }
}
```

`npm` will generate a `package-lock.json` with two packages: one for the root package and one for the dependency on the root package. The root package dependency will have a `resolved` value of an empty string. When migrating `package.json`s with this structure, Bun would panic because a root dependency of this kind was not expected.

Fixed thanks to [@dylan-conway](https://github.com/dylan-conway)!

### Fixed: Multiple output files without an `outdir` in `Bun.build`

A bug was fixed where calling `Bun.build` with multiple output files and no `outdir` would fail with a message saying an output directory was required. `Bun.build` defaults to an in-memory build when `outdir` is undefined, so this error was incorrect. Now, `Bun.build` will create a build with multiple output files in-memory without error.

```ts#build.ts
const result = await Bun.build({
    entrypoints: ["main.ts", "index.html"],
})

for (const output of result.outputs) {
    console.log(output.path);
}
// "./main.js"
// "./index.js"
// "./index-7qpw8w4s.html"
```

Fixed thanks to [@BjornTheProgrammer](https://github.com/BjornTheProgrammer)!

### Fixed: Amazon Linux 2 regression

A regression in Bun v1.1.33 where Amazon Linux 2 was no longer supported has been fixed.

The bug was caused by depending on the libc `powf` function, which used a later version of glibc than Amazon Linux 2 supported. We have added a regression test that ensures we don't add dependencies on symbols that are not available in glibc versions 2.27. This bug also impacted Vercel builds when using their Node.js v18 image.

### Fixed: `bun:sqlite` regression on arm64 Linux with glibc-compat

A regression where using `bun:sqlite` via glibc inside of alpine linux on Linux would lead to a crash has been fixed.

### Added: `node:net` Socket's `bytesWritten` property

The `bytesWritten` property on `node:net` `Socket` objects is now correctly implemented, thanks to [@cirospaciari](https://github.com/cirospaciari).

This also makes the `encoding` option in `net.Socket` consistent with Node.js' behavior.

### Fixed: `node:fs`' options parsing with `"encoding"` option

The `encoding` option in `node:fs` was not being parsed correctly in certain node:fs functions. This led to throwing errors when Node does not throw them. This has been fixed.

### Fixed: Potential crash when appending a FormData from a `File` object created from another `File`

A bug where appending a `FormData` from a Web `File` object created from another `File` could cause a crash in certain cases has been fixed. This impacted the OpenAI package.

### Fixed: napi property methods on non-objects

Node-API functions support calling methods on primitive values like string literals and numbers. This is consistent with JavaScript (like `"foo".slice()`), but in native code, to improve performance, the underlying implementation treats these values differently than in JavaScript.

A bug where we were throwing an error when calling Node-API functions like `String.prototype.slice` or `Number.prototype.toFixed` on non-objects has been fixed, thanks to [@190n](https://github.com/190n).

### Fixed: `TextEncoder.encode(undefined)` incorrect result

`TextEncoder.encode()` stringifies input, unless the input is `undefined`. Bun was incorrectly including `undefined` in the string conversion, where it should have returned an empty `Uint8Array`.

```js#index.js
const encoder = new TextEncoder();
console.log(encoder.encode());
// Before:       Uint8Array(9) [ 117, 110, 100, 101, 102, 105, 110, 101, 100 ]
// Bun v1.1.34:  Uint8Array(0) []
```

Fixed thanks to [@dylan-conway](https://github.com/dylan-conway)!

### Fixed: Crash in `Error.prepareStackTrace` argument conversion

A bug was fixed where calling `Error.prepareStackTrace()` with an array of non-CallSite values would crash. Now, values are stringified for the error stack trace as expected.

```js#index.js
const result = Error.prepareStackTrace(new Error("oops"), [{ a: 1 }]);
console.log(result);
// Error: oops
//     at [object Object]
```

### Fixed: Several HTTP spec issues

Our [uWebSockets](https://github.com/uNetworking/uWebSockets) dependency was updated and added additional HTTP/1.1 spec compliance tests, addressing several HTTP spec issues involving invalid headers.

Thanks to Alex Hultman for the important fix!

### Fixed: `EventEmitter.name`

A bug was fixed where `EventEmitter.name` was set to `EventEmitter2` instead of `EventEmitter`.

```js#index.js
import { EventEmitter } from "events";
console.log(EventEmitter.name);
// Before:         EventEmitter2
// Bun v1.1.34:    EventEmitter
```

### Fixed: additional arguments escaping with `package.json` scripts

Arguments were not being escaped correctly when passed to a script in `package.json`. This has been fixed thanks to [@pfgithub](https://github.com/pfgithub)!

Given the following `package.json`:

```json#package.json
{
    "scripts": {
        "args": "echo"
    }
}
```

`bun run args \$HOME` would previously print `/path/to/home` instead of `$HOME`.

### Improved: Removed warning for unused registry options in `.npmrc`

Previously, Bun would print a warning if an option from `npmrc` was set for a registry other than the default registry (set with `registry=<...>`). We've removed this warning, as it was unnecessary.

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

### Improved: `package.json` formatting with first dependency from `bun add`

When adding the first dependency to `dependencies` with `bun add/install/update`, the resulting `package.json` will now have nicer formatting.

```sh
$ bun add jquery@4.0.0-beta.2
```

```json-diff#package.json
{
    "name": "dependency-formatting",
+   "dependencies": {
+       "jquery": "4.0.0-beta.2"
+   },
-   "dependencies": { "jquery": "4.0.0-beta.2" }
}
```

Thanks to [@nektro](https://github.com/nektro)!

### Improved: `bun install -g <package>` will not link transitive binaries

Installing a package globally will no longer link binaries from transitive dependencies to the global `bin` directory. This will prevent placing unexpected binaries in PATH.

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

## Thanks to 14 contributors!

- [@190n](https://github.com/190n)
- [@arthurvanl](https://github.com/arthurvanl)
- [@BjornTheProgrammer](https://github.com/BjornTheProgrammer)
- [@cirospaciari](https://github.com/cirospaciari)
- [@DonIsaac](https://github.com/DonIsaac)
- [@dylan-conway](https://github.com/dylan-conway)
- [@Electroid](https://github.com/Electroid)
- [@fel1x-developer](https://github.com/fel1x-developer)
- [@gjungb](https://github.com/gjungb)
- [@Jarred-Sumner](https://github.com/Jarred-Sumner)
- [@nektro](https://github.com/nektro)
- [@paperclover](https://github.com/paperclover)
- [@pfgithub](https://github.com/pfgithub)
- [@zackradisic](https://github.com/zackradisic)
