This project is a sandbox to demo the problem when running a sanity script with Bun.
This is an integration problem, so it'll demand a bit effort.
First step, you'll need to create a sanity project to be able to reproduce.
I won't dive deep on how to do that, so please follow to https://www.sanity.io/ or run bun create sanity@latest
. If you already have an account, you can simply create a dummy project with some sample data.
All you'll need from this sanity project is the projectId
.
With the sanity project in place, now we can do the following:
-
install the dependencies using bun
bun install
-
create a .env file:
cp .env.sample .env
-
open the
.env
file and fillSANITY_PROJECT_ID
-
run the entry script using bun:
bun run index.ts
You'll see the process never complete.
-
Now, quite the current process and run the same script with
tsx
bun tsx index.ts
You'll see we have the console we expect