Files
zeekay 10e6fec4c0 debrand: the brand token is INSIGHTS_, and a wrong one stops the container
The rule table mapped HOG_ -> FN_ ahead of any POSTHOG rule, so POSTHOG_FOO
split into POST + HOG_ and came out POSTFN_FOO. Nothing sets that. The live
pods set INSIGHTS_SKIP_MIGRATION_CHECKS, which bin/migrate-check reads on the
container entrypoint, so the misspelling does not degrade a feature -- it runs
migrate --check against a database whose history this tree does not share and
the container never starts.

Both replacements are measured against the shipped tree rather than chosen:
every HOG_ name with a counterpart there is spelled INSIGHTS_ (HOG_QL ->
INSIGHTS_QL, HOG_FUNCTION_TEMPLATES -> INSIGHTS_FUNCTION_TEMPLATES, 12 of 12
determinate cases), and FN_ appears in it nowhere. Upstream carries 95 HOG_
tokens and zero FN_ ones, so repairing FN_ back out is exactly the inverse of
the bad rule and cannot collide with an upstream name.

The rule is fixed for the next convergence, and the tree it already produced is
repaired in the same commit -- the codemod is idempotent against its own output,
so it cannot undo this itself.
2026-08-01 17:42:28 -07:00

70 lines
2.9 KiB
TypeScript

import { OnboardingComponentsContext, createInstallation } from 'scenes/onboarding/shared/OnboardingDocsContentWrapper'
import { getNodeJSSteps as getNodeJSStepsPA } from '../product-analytics/nodejs'
import { StepDefinition } from '../steps'
export const getHonoSteps = (ctx: OnboardingComponentsContext): StepDefinition[] => {
const { CodeBlock, Markdown, dedent } = ctx
const installSteps = getNodeJSStepsPA(ctx)
const exceptionHandlingStep: StepDefinition = {
title: 'Exception handling example',
badge: 'required',
content: (
<>
<Markdown>
{dedent`
Hono uses [\`app.onError\`](https://hono.dev/docs/api/exception#handling-httpexception) to handle uncaught exceptions. You can take advantage of this for error tracking.
Remember to **export** your [project token](https://app.hanzo.ai/settings/project#variables) as an environment variable.
`}
</Markdown>
<CodeBlock
blocks={[
{
language: 'typescript',
file: 'index.ts',
code: dedent`
import { Insights } from 'insights-node'
const insights = new Insights(process.env.INSIGHTS_TOKEN, { host: 'https://us.i.hanzo.ai' })
app.onError(async (err, c) => {
insights.captureException(err, 'user_distinct_id_with_err_rethrow', {
path: c.req.path,
method: c.req.method,
url: c.req.url,
headers: c.req.header(),
// ... other properties
})
await insights.flush()
// other error handling logic
return c.text('Internal Server Error', 500)
})
`,
},
]}
/>
</>
),
}
const verifyStep: StepDefinition = {
title: 'Verify error tracking',
badge: 'recommended',
checkpoint: true,
content: (
<Markdown>
{dedent`
Before proceeding, let's make sure exception events are being captured and sent to Insights. You should see events appear in the activity feed.
[Check for exceptions in Insights](https://app.hanzo.ai/activity/explore)
`}
</Markdown>
),
}
return [...installSteps, exceptionHandlingStep, verifyStep]
}
export const HonoInstallation = createInstallation(getHonoSteps)