Repository navigation
docs: complete the OIDC steps and fix the sourcemap check in the web example #754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,14 +19,18 @@ samples, guidance on mobile development, and a full API reference. | |||||||||
|
|
||||||||||
| Uploading sourcemaps needs [hog](https://posthog.com/docs/cli/migrating), PostHog's CLI. Install it with `npm install -g hog` or `brew install posthog/tap/hog`, then log in with `hog auth login`. | ||||||||||
|
|
||||||||||
| In GitHub Actions, install hog with the [PostHog/setup-hog](https://github.com/PostHog/setup-hog) action. The job can then upload with its OIDC token instead of a personal API key: run `hog ci setup --scope error_tracking:write` once in the repository, and give the job `permissions: id-token: write`. | ||||||||||
| In GitHub Actions, install hog with the [PostHog/setup-hog](https://github.com/PostHog/setup-hog) action. The job can then upload with its OIDC token instead of a personal API key: | ||||||||||
|
|
||||||||||
| 1. Run `hog ci setup --scope error_tracking:write` once in the repository, and have an organization admin approve the request. | ||||||||||
| 2. Put the project ID that `hog ci setup` prints in `posthog.json` as `"projectId"`, or set `HOG_PROJECT_ID` (and `HOG_HOST` outside US Cloud) in the job. | ||||||||||
| 3. Give the job `permissions: id-token: write`. | ||||||||||
|
|
||||||||||
| ```bash | ||||||||||
| # release mode | ||||||||||
| rm -rf build/web | ||||||||||
| flutter build web --source-maps | ||||||||||
| hog error-tracking inject build/web --release-name posthog_flutter_example --release-version 1.0.0 --build 42 | ||||||||||
| # check the sourcemaps has chunk_id and release_id injected (*.js.map file) | ||||||||||
| # check the sourcemaps have chunk_id injected (*.js.map file). The release goes into the js file, not the map | ||||||||||
| # check the js file has _posthogChunkIds injected (*.js file) | ||||||||||
|
Comment on lines
+33
to
34
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Line 33 now says the release goes into the js file, but the js check below it still names only
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||
| # check the chunk_id and _posthogChunkIds match | ||||||||||
| hog error-tracking upload build/web --kind js --release-name posthog_flutter_example --release-version 1.0.0 --build 42 | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Step 2 drops the
hostfrom theposthog.jsonroute, so an EU Cloud job that follows it literally can't get a token.In the job, hog takes the exchange host from
HOG_HOST, or from a Cloudhostinposthog.json, and otherwise useshttps://us.posthog.com(hog/src/posthog/credentials.ts:300-313,hog/README.md:505, pinned byworkload.test.ts:198-223). With only"projectId"inposthog.json, an EU job asks for an OIDC token for US Cloud and exchanges it there for an EU project, which fails. TheHOG_HOSTnote in this step only covers the env-var route.hog ci setupprints both values, e.g.{ "host": "https://eu.posthog.com", "projectId": 123 }(setup.ts:49-58, 209-221). hog's README (L499) and the migration guide (posthog.com/contents/docs/cli/migrating.mdx:213) both say to add both, and this was part of the earlier suggestion on #752 (#752 (comment)).Consider:
(Checked against hog 1.0.0, PostHog/posthog@0441094.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 Thanks! #754 merged before this landed, so it's in #755.