Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: guard UserSignedUp events with distinctId truthiness check in OAuth callbacks

Devin AI0a2e066b1b66
diff --git a/backend/src/server/routes/v1/sso-router.ts b/backend/src/server/routes/v1/sso-router.ts
index 586f30137c..89b1fe14b0 100644
--- a/backend/src/server/routes/v1/sso-router.ts
+++ b/backend/src/server/routes/v1/sso-router.ts
@@ -88,7 +88,7 @@ export const registerOauthMiddlewares = (server: FastifyZodProvider) => {
});
}
- if (!isUserCompleted) {
+ if (!isUserCompleted && googleDistinctId) {
void server.services.telemetry.sendPostHogEvents({
event: PostHogEventTypes.UserSignedUp,
distinctId: googleDistinctId,
@@ -184,7 +184,7 @@ export const registerOauthMiddlewares = (server: FastifyZodProvider) => {
});
}
- if (!isUserCompleted) {
+ if (!isUserCompleted && githubDistinctId) {
void server.services.telemetry.sendPostHogEvents({
event: PostHogEventTypes.UserSignedUp,
distinctId: githubDistinctId,
@@ -272,7 +272,7 @@ export const registerOauthMiddlewares = (server: FastifyZodProvider) => {
});
}
- if (!isUserCompleted) {
+ if (!isUserCompleted && gitlabDistinctId) {
void server.services.telemetry.sendPostHogEvents({
event: PostHogEventTypes.UserSignedUp,
distinctId: gitlabDistinctId,