Skip to content

Commit 733200a

Browse files
authored
[v8] Use globalThis.crypto.randomUUID for runtime-agnostic UUIDs (#1398)
Replaces Node.js-specific crypto import with globalThis.crypto to ensure compatibility across Node.js 20 and other runtimes. ## Description ## Documentation Does this require changes to the WorkOS Docs? E.g. the [API Reference](https://workos.com/docs/reference) or code snippets need updates. ``` [ ] Yes ``` If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.
1 parent 62d946c commit 733200a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/audit-logs/audit-logs.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { randomUUID } from 'crypto';
21
import { WorkOS } from '../workos';
32
import {
43
CreateAuditLogEventOptions,
@@ -34,7 +33,9 @@ export class AuditLogs {
3433
// Auto-generate idempotency key if not provided
3534
const optionsWithIdempotency: CreateAuditLogEventRequestOptions = {
3635
...options,
37-
idempotencyKey: options.idempotencyKey || `workos-node-${randomUUID()}`,
36+
idempotencyKey:
37+
options.idempotencyKey ||
38+
`workos-node-${globalThis.crypto.randomUUID()}`,
3839
};
3940

4041
await this.workos.post(

0 commit comments

Comments
 (0)