mirror of
https://github.com/better-auth/better-auth.git
synced 2026-07-29 11:50:12 -05:00
chore: fix async local storage import (#4857)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { AsyncLocalStorage } from "node:async_hooks";
|
||||
import type { AsyncLocalStorage } from "node:async_hooks";
|
||||
import type { Adapter } from "../types";
|
||||
|
||||
/**
|
||||
@@ -14,6 +14,9 @@ const AsyncLocalStoragePromise: Promise<typeof AsyncLocalStorage> = import(
|
||||
)
|
||||
.then((mod) => mod.AsyncLocalStorage)
|
||||
.catch((err) => {
|
||||
if ("AsyncLocalStorage" in globalThis) {
|
||||
return (globalThis as any).AsyncLocalStorage;
|
||||
}
|
||||
console.warn(
|
||||
"[better-auth] Warning: AsyncLocalStorage is not available in this environment. Some features may not work as expected.",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user