Skip to content

Commit f547cc9

Browse files
committed
fix: don't cache failed /users/me identity
1 parent ba1b35a commit f547cc9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

packages/sdk/src/utils/observability.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,14 @@ async function getDistinctId(
111111
// Fall through to API key hash
112112
}
113113

114+
// Don't cache the fallback — a transient /users/me failure should not poison the cache for the entire process lifetime
114115
const hash = createHash("sha256").update(apiKey).digest("hex").slice(0, 16);
115-
const result = {
116+
return {
116117
identity: {
117118
distinct_id: `apikey-${hash}`,
118119
distinct_id_source: "api_key_hash",
119120
},
120121
};
121-
identityCache.set(apiKey, result);
122-
return result;
123122
}
124123

125124
export function _resetIdentityCache() {

0 commit comments

Comments
 (0)