fix: ingest events

This commit is contained in:
sriram veeraghanta 2024-04-06 17:13:24 +05:30
parent 90609b306f
commit 57f2445bb8
4 changed files with 37 additions and 9 deletions

View File

@ -42,9 +42,9 @@ const PostHogProvider: FC<IPosthogWrapper> = (props) => {
}, [user, workspaceRole, projectRole]); }, [user, workspaceRole, projectRole]);
useEffect(() => { useEffect(() => {
if (posthogAPIKey && posthogHost) { if (posthogAPIKey && (process.env.NEXT_PUBLIC_POSTHOG_HOST || posthogHost)) {
posthog.init(posthogAPIKey, { posthog.init(posthogAPIKey, {
api_host: posthogHost || "https://app.posthog.com", api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST || posthogHost || "https://app.posthog.com",
debug: process.env.NEXT_PUBLIC_POSTHOG_DEBUG === "1", // Debug mode based on the environment variable debug: process.env.NEXT_PUBLIC_POSTHOG_DEBUG === "1", // Debug mode based on the environment variable
autocapture: false, autocapture: false,
capture_pageview: false, // Disable automatic pageview capture, as we capture manually capture_pageview: false, // Disable automatic pageview capture, as we capture manually

1
web/next-env.d.ts vendored
View File

@ -1,5 +1,6 @@
/// <reference types="next" /> /// <reference types="next" />
/// <reference types="next/image-types/global" /> /// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />
// NOTE: This file should not be edited // NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information. // see https://nextjs.org/docs/basic-features/typescript for more information.

View File

@ -3,6 +3,9 @@ require("dotenv").config({ path: ".env" });
const { withSentryConfig } = require("@sentry/nextjs"); const { withSentryConfig } = require("@sentry/nextjs");
const nextConfig = { const nextConfig = {
reactStrictMode: false,
swcMinify: true,
output: "standalone",
async headers() { async headers() {
return [ return [
{ {
@ -11,8 +14,6 @@ const nextConfig = {
}, },
]; ];
}, },
reactStrictMode: false,
swcMinify: true,
images: { images: {
remotePatterns: [ remotePatterns: [
{ {
@ -22,7 +23,18 @@ const nextConfig = {
], ],
unoptimized: true, unoptimized: true,
}, },
output: "standalone", async rewrites() {
return [
{
source: "/ingest/static/:path*",
destination: "https://us-assets.i.posthog.com/static/:path*",
},
{
source: "/ingest/:path*",
destination: "https://us.i.posthog.com/:path*",
},
]
}
}; };
if (parseInt(process.env.NEXT_PUBLIC_ENABLE_SENTRY || "0", 10)) { if (parseInt(process.env.NEXT_PUBLIC_ENABLE_SENTRY || "0", 10)) {

View File

@ -1,13 +1,28 @@
{ {
"extends": "tsconfig/nextjs.json", "extends": "tsconfig/nextjs.json",
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], "include": [
"exclude": ["node_modules"], "next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": [
"node_modules"
],
"compilerOptions": { "compilerOptions": {
"baseUrl": ".", "baseUrl": ".",
"jsx": "preserve", "jsx": "preserve",
"esModuleInterop": true, "esModuleInterop": true,
"paths": { "paths": {
"@/*": ["*"] "@/*": [
"*"
]
},
"plugins": [
{
"name": "next"
} }
],
"strictNullChecks": true
} }
} }