8000 chore: inject and upload sourcemaps for plugin server by hpouillot · Pull Request #33456 · PostHog/posthog · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

hpouillot
Copy link
Contributor
@hpouillot hpouillot commented Jun 10, 2025

Changes

  • Use @posthog/cli to inject and upload sourcemaps during build process
  • Upgrade to latest version of posthog-node to include chunkIds in exceptions

TODO

@@ -102,6 +102,12 @@ jobs:
- name: Check builds correctly
run: pnpm --filter=@posthog/plugin-server build

- name: Inject sourcemaps
Copy link
Contributor Author

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

@hpouillot hpouillot marked this pull request as draft June 10, 2025 14:27
Copy link
Contributor
@greptile-apps greptile-apps bot left a 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

Comment on lines +105 to +109
- name: Inject sourcemaps
run: pnpm --filter=@posthog/plugin-server sourcemap:inject

- name: Upload sourcemaps
run: pnpm --filter=@posthog/plugin-server sourcemap:upload
Copy link
Contributor

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.

@hpouillot hpouillot marked this pull request as ready for review June 10, 2025 14:41
@hpouillot hpouillot requested review from benjackwhite, a team, daibhin and oliverb123 June 10, 2025 14:42
Copy link
Contributor

Size Change: 0 B

Total Size: 2.54 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 2.54 MB

compressed-size-action

Copy link
Contributor
@greptile-apps greptile-apps bot left a 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 in plugin-server/src/utils/posthog.ts and replaced with local definition
  • Requires environment variables POSTHOG_CLI_TOKEN and POSTHOG_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

@hpouillot
Copy link
Contributor Author

We should probably inject and upload elsewhere but I'm not sure about the build / deployment process for plugin-server

@oliverb123
Copy link
Contributor

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
Copy link
Contributor

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?

Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0