chore: add environment created posthog event (#2966)

This commit is contained in:
Matti Nannt
2024-08-05 20:51:25 +02:00
committed by GitHub
parent c65c1af023
commit b0c65c76e6

View File

@@ -17,6 +17,7 @@ import {
import { DatabaseError, ResourceNotFoundError, ValidationError } from "@formbricks/types/errors";
import { cache } from "../cache";
import { getOrganizationsByUserId } from "../organization/service";
import { capturePosthogEnvironmentEvent } from "../posthogServer";
import { getProducts } from "../product/service";
import { validateInputs } from "../utils/validate";
import { environmentCache } from "./cache";
@@ -192,6 +193,10 @@ export const createEnvironment = async (
productId: environment.productId,
});
await capturePosthogEnvironmentEvent(environment.id, "environment created", {
environmentType: environment.type,
});
return environment;
} catch (error) {
if (error instanceof Prisma.PrismaClientKnownRequestError) {