Skip to content

Commit 89985e3

Browse files
committed
prevent users from using Kernel with Bun
1 parent 3fd6a3e commit 89985e3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/client.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,13 @@ export class Kernel {
187187
apiKey = readEnv('KERNEL_API_KEY'),
188188
...opts
189189
}: ClientOptions = {}) {
190+
// Check for Bun runtime in a way that avoids type errors if Bun is not defined
191+
if (typeof globalThis !== 'undefined' && typeof (globalThis as any).Bun !== 'undefined' && (globalThis as any).Bun.version) {
192+
throw new Errors.KernelError(
193+
'The Bun runtime is not supported. Please use a different runtime.',
194+
);
195+
}
196+
190197
if (apiKey === undefined) {
191198
throw new Errors.KernelError(
192199
"The KERNEL_API_KEY environment variable is missing or empty; either provide it, or instantiate the Kernel client with an apiKey option, like new Kernel({ apiKey: 'My API Key' }).",

0 commit comments

Comments
 (0)