Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save danawoodman/d55995dec9e43433c6d426ea86c41513 to your computer and use it in GitHub Desktop.
Save danawoodman/d55995dec9e43433c6d426ea86c41513 to your computer and use it in GitHub Desktop.
Get bun.lock files to work with Cloudflare Workers CI

Get bun.lock files to work with Cloudflare Workers CI

As of the time of this writing, Cloudflare Workers CI does not work with the newer text-based bun.lock file and instead requires a bun.lockb file to build your app via their CI system.

This usually manifests itself with the following error when trying to deploy your apps using a bun.lock file:

13:48:54.691	Initializing build environment...
13:49:02.821	Success: Finished initializing build environment
13:49:03.776	Cloning repository...
13:49:08.079	Detected the following tools from environment: [email protected], [email protected]
13:49:08.080	Installing bun 1.2.20
13:49:10.103	Installing project dependencies: bun install --frozen-lockfile
13:49:10.197	bun install v1.2.20 (282dda62)
13:49:10.213	error: lockfile had changes, but lockfile is frozen
13:49:10.214	note: try re-running without --frozen-lockfile and commit the updated lockfile
13:49:10.220	Failed: error occurred while installing tools or dependencies

To get bun.lock files to work, you have to do two things:

1. Configure build to skip install and set bun version

Add the following to your to your build config variables (Settings -> Build -> Variables and secrets):

  • SKIP_DEPENDENCY_INSTALL=true
  • BUN_VERSION=1.2.20 (or whatever version you want to use)
image

2. Run bun install in your build command

In your build command (Settings -> Build -> Build configuration), add bun install as the first step, before any build commands or deploy scripts.

This will use the now setup bun version and install dependencies using your bun.lock file.

image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment