6ede33ccdb
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64, , runner, false, cpu) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64, , runner, false, cpu) (push) Blocked by required conditions
Build and Push Docker Images / compute_version (push) Waiting to run
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, , production, false, cpu) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda126, production, true, cuda126) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda126, production, true, cuda126) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda, production, true, cuda) (push) Blocked by required conditions
Build and Push Docker Images / verify_digests (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (backend, surfsense-backend, , cpu) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, , production, false, cpu) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda, production, true, cuda) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda, cuda) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda126, cuda126) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (web, surfsense-web, , cpu) (push) Blocked by required conditions
Build and Push Docker Images / finalize_release (push) Blocked by required conditions
Obsidian Plugin Lint / lint (push) Waiting to run
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import type { Instrumentation } from "next";
|
|
|
|
const POSTHOG_COOKIE_RE = /ph_phc_.*?_posthog=([^;]+)/;
|
|
|
|
export function register() {
|
|
// No-op — PostHog server client is lazily initialized
|
|
}
|
|
|
|
export const onRequestError: Instrumentation.onRequestError = async (err, request) => {
|
|
if (process.env.NEXT_RUNTIME === "nodejs") {
|
|
const { default: PostHogClient } = await import("./lib/posthog/server");
|
|
|
|
try {
|
|
const posthog = PostHogClient();
|
|
|
|
let distinctId: string | undefined;
|
|
const rawCookie = request.headers.cookie;
|
|
if (rawCookie) {
|
|
const cookieString = Array.isArray(rawCookie) ? rawCookie.join("; ") : rawCookie;
|
|
const postHogCookieMatch = cookieString.match(POSTHOG_COOKIE_RE);
|
|
if (postHogCookieMatch?.[1]) {
|
|
try {
|
|
const decodedCookie = decodeURIComponent(postHogCookieMatch[1]);
|
|
const postHogData = JSON.parse(decodedCookie);
|
|
distinctId = postHogData.distinct_id;
|
|
} catch {
|
|
// Cookie parsing failed — capture without distinct_id
|
|
}
|
|
}
|
|
}
|
|
|
|
await posthog.captureException(err, distinctId);
|
|
} catch {
|
|
// PostHog server capture failed — don't let it affect the request
|
|
}
|
|
}
|
|
};
|