Skip to content

Commit 93e8795

Browse files
committed
fix(api): prevent null idempotency keys in responses, only undefined accepted
1 parent 36168b3 commit 93e8795

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/core/src/v3/serverOnly/idempotencyKeys.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import { IdempotencyKeyOptionsSchema } from "../schemas/api.js";
88
* @returns The user-provided key, the hash as fallback, or null if neither exists
99
*/
1010
export function getUserProvidedIdempotencyKey(run: {
11-
idempotencyKey: string | null;
11+
idempotencyKey: string | null | undefined;
1212
idempotencyKeyOptions: unknown;
13-
}): string | null {
13+
}): string | undefined {
1414
const parsed = IdempotencyKeyOptionsSchema.safeParse(run.idempotencyKeyOptions);
1515
if (parsed.success) {
1616
return parsed.data.key;
1717
}
18-
return run.idempotencyKey;
18+
return run.idempotencyKey ?? undefined;
1919
}
2020

2121
/**

0 commit comments

Comments
 (0)