Skip to content

Commit eb49928

Browse files
fix(nextjs): Keyless drift detection telemetry bug from usage of async methods (#6594)
1 parent c2e40a6 commit eb49928

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.changeset/sweet-vans-wonder.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@clerk/nextjs": patch
3+
---
4+
5+
Fix keyless drift detection failure caused by invalid fs module methods.

packages/nextjs/src/server/keyless-telemetry.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ function getTelemetryFlagFilePath(): string {
4444
async function tryMarkTelemetryEventAsFired(): Promise<boolean> {
4545
try {
4646
if (canUseKeyless) {
47-
const { mkdir, writeFile } = nodeFsOrThrow();
47+
const { mkdirSync, writeFileSync } = nodeFsOrThrow();
4848
const flagFilePath = getTelemetryFlagFilePath();
4949
const flagDirectory = dirname(flagFilePath);
5050

5151
// Ensure the directory exists before attempting to write the file
52-
await mkdir(flagDirectory, { recursive: true });
52+
await mkdirSync(flagDirectory, { recursive: true });
5353

5454
const flagData = {
5555
firedAt: new Date().toISOString(),
5656
event: EVENT_KEYLESS_ENV_DRIFT_DETECTED,
5757
};
58-
await writeFile(flagFilePath, JSON.stringify(flagData, null, 2), { flag: 'wx' });
58+
await writeFileSync(flagFilePath, JSON.stringify(flagData, null, 2), { flag: 'wx' });
5959
return true;
6060
} else {
6161
return false;

0 commit comments

Comments
 (0)