The best way to control Claude Code, Codex and more from any computer or phone
fix(server): load Cursor keyring with createRequire (#13678)
Yash Singh committed
Sep 25, 2026 at 15:17 UTC
f5bd2fddbf00021b29c1dbe32210240886806718
1 file changed
+5
-1
apps/server/src/provider/cursorCredentialStore.ts
+5
-1
@@ -1,5 +1,9 @@
1
+import * as NodeModule from "node:module";
2
+
3
const CACHE_MS = 5 * 60_000;
4
5
+const requireForKeyring = NodeModule.createRequire(import.meta.url);
6
+
7
/** Share one Keychain request across usage history and limits in this server process. */
8
export function makeCachedCursorAccessTokenReader(
9
read: () => Promise<string | null>,
@@ -24,6 +28,6 @@ export function makeCachedCursorAccessTokenReader(
28
29
/** Read the Cursor CLI's default macOS credential without invoking the shared security binary. */
30
export const readMacCursorAccessToken = makeCachedCursorAccessTokenReader(async () => {
27
- const { AsyncEntry } = await import("@napi-rs/keyring");
31
+ const { AsyncEntry } = requireForKeyring("@napi-rs/keyring") as typeof import("@napi-rs/keyring");
32
return (await new AsyncEntry("cursor-access-token", "cursor-user").getPassword()) ?? null;
33
});