Generated `instrumentation.ts` throws in development when the PostHog key is missing

Aperta
#1,462 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
nextjs, typescript
Ambito
devtools

Direzione di ricerca

The bug is in the generated instrumentation.ts file, specifically its register() function, which throws when NODE_ENV is development and NEXT_PUBLIC_POSTHOG_KEY is unset. The payload does not name the template or generator that emits this file, so first locate where the wizard writes instrumentation.ts and check how it handles the missing key. Done means that with no key in development, register() logs a warning and continues with analytics off, and the dev server starts.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

What happened: The new register() path (AI observability and log capture) throws NEXT_PUBLIC_POSTHOG_KEY variable required by PostHog is missing… whenever NODE_ENV === "development" and no key is set. Any contributor without a PostHog key gets a dev server that won't start. Before this, the app treated a missing key as "analytics off".

Expected: log a warning and carry on with analytics off, rather than throwing.

Lingua principale
TypeScript
Stelle
208
Fork
58
Merge medio
2g 7h
PR unite (30g)
76

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PostHog/wizard

Tutte le issue di PostHog/wizard

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.