-
Notifications
You must be signed in to change notification settings - Fork 1.7k
chore: inject and upload sourcemaps for plugin server #33456
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
base: master
Are you sure you want to change the base?
Conversation
@@ -102,6 +102,12 @@ jobs: | |||
- name: Check builds correctly | |||
run: pnpm --filter=@posthog/plugin-server build | |||
|
|||
- name: Inject sourcemaps |
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.
we probably want to do it only when pushing on master but let's keep it to test workflow execution
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.
PR Summary
This PR enhances the plugin server build process by adding sourcemap support for improved debugging capabilities in production environments.
- Adds sourcemap injection and upload steps in
.github/workflows/ci-plugin-server.yml
workflow - Upgrades posthog-node from v4.14.0 to v4.18.0 in
plugin-server/package.json
- Integrates
@posthog/cli
for sourcemap handling with new NPM scripts - Warning: Requires three new environment variables (
POSTHOG_CLI_TOKEN
,POSTHOG_CLI_ENV_ID
,POSTHOG_CLI_HOST
) that need to be configured
2 files reviewed, 1 comment
Edit PR Review Bot Settings | Greptile
- name: Inject sourcemaps | ||
run: pnpm --filter=@posthog/plugin-server sourcemap:inject | ||
|
||
- name: Upload sourcemaps | ||
run: pnpm --filter=@posthog/plugin-server sourcemap:upload |
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.
logic: Missing required environment variables. The sourcemap injection and upload steps will fail without POSTHOG_CLI_TOKEN, POSTHOG_CLI_ENV_ID, and POSTHOG_CLI_HOST environment variables.
Size Change: 0 B Total Size: 2.54 MB ℹ️ View Unchanged
|
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.
PR Summary
Modified type handling in plugin server for better sourcemap integration, replacing imported SeverityLevel with a local type definition while maintaining existing functionality.
- Removed external dependency on
SeverityLevel
type from posthog-node inplugin-server/src/utils/posthog.ts
and replaced with local definition - Requires environment variables
POSTHOG_CLI_TOKEN
andPOSTHOG_CLI_ENV_ID
for sourcemap upload functionality
Note: This review focuses on recent changes to type definitions and sourcemap setup.
3 files reviewed, no comments
Edit PR Review Bot Settings | Greptile
We should probably inject and upload elsewhere but I'm not sure about the build / deployment process for plugin-server |
Sorry this took me so long to review. I think it's worth getting input from @PostHog/team-ingestion or @PostHog/team-cdp here, tbh, I think they're most familiar with/close to the plugin server's deployment script. @PostHog/team-infra will also probably know most about the workflows and dockerfiles in question (Frank and Daniel in particular, I think) My understanding is that plugin server pods run the posthog-cloud docker image, so what you probably actually want to do is modify the dockerfile stage that builds the plugin server to also do the inject/upload (and pass in an env var to only do it when the docker file is built from the CD workflow). |
run: pnpm --filter=@posthog/plugin-server sourcemap:inject | ||
|
||
- name: Upload sourcemaps | ||
run: pnpm --filter=@posthog/plugin-server sourcemap:upload |
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.
Saw the other comment about this from @oliverb123 (not in a comment thread booooo ;) )
I don't exactly know what happens when this happens 😅 Like is this meant to be for the deployed version or is it okay to be uploading just "whenever" - here it will upload whenever we run the CI checks which i assume is not what we want?
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.
It's fine either way in so far as nothing will break, but yeah the goal is on deployment, which I think means it needs to be done in the dockerfile.
Changes
TODO
POSTHOG_CLI_TOKEN
,POSTHOG_CLI_ENV_ID
env variables in github secrets to fix uploadCheck doc here: https://www.npmjs.com/package/@posthog/cli