8000 feat: cli multipart uploads by daibhin · Pull Request #33546 · PostHog/posthog · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: cli multipart uploads #33546

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

Merged
merged 4 commits into from
Jun 12, 2025
Merged

feat: cli multipart uploads #33546

merged 4 commits into from
Jun 12, 2025

Conversation

daibhin
Copy link
Contributor
@daibhin daibhin commented Jun 11, 2025

Problem

Users are complaining that their source map uploads are hitting 413 limits. We have a file limit of 21MB when not using multipart file uploads

Changes

  • Support multipart file uploads
  • Make multipart uploads keyed on a request param for backwards compatibility

Changes

Possibly an easier way to do this but wanted to be certain that the same content was being uploaded, so...

Picked a random symbol set from S3 which had already been injected with a chunk id (given that is randomly generated)

SELECT *
FROM posthog_errortrackingsymbolset
WHERE ref NOT LIKE '%http%'
order by created_at desc

Downloaded that file and got the contents of the source & map

let bytes = include_bytes!("/Users/david/Downloads/<SYMBOL_SET>").to_vec();
let output = read_symbol_data::<SourceAndMap>(bytes).unwrap();

print!("{}", output.sourcemap);
print!("{}", output.minified_source);

Created the two files in a ./chunks directory and ran posthog-cli sourcemap upload --directory ./chunks

Verified that the content_hash of the created symbol set record on my local machine matched that of the remote one e.g. multipart upload worked!

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

Added multipart upload support to the PostHog CLI to resolve source map upload failures due to 21MB file size limits (HTTP 413 errors).

  • Modified cli/Cargo.toml to enable reqwest's multipart feature for chunked file uploads
  • Updated cli/src/commands/sourcemap/upload.rs to implement multipart form functionality with a multipart=true parameter
  • Added multipart handling in posthog/api/error_tracking.py while maintaining backwards compatibility
  • Added TODOs around release object handling that require discussion
  • Implementation needs additional error handling around multipart responses

3 files reviewed, 1 comment
Edit PR Review Bot Settings | Greptile

Comment on lines +75 to +76
let mut params: Vec<(&'static str, &str)> =
vec![("chunk_id", &upload.chunk_id), ("multipart", "true")];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Vec type could be simplified to just Vec<(&str, &str)> since 'static isn't needed here - the strings don't need static lifetime

Suggested change
let mut params: Vec<(&'static str, &str)> =
vec![("chunk_id", &upload.chunk_id), ("multipart", "true")];
let mut params: Vec<(&str, &str)> =
vec![("chunk_id", &upload.chunk_id), ("multipart", "true")];

cli/Cargo.toml Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't really sure based on the CONTRIBUTING guide if I was supposed to bump the version in this PR or create a new one after this merges

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either works - the release flow is actually triggered by the tag push, not the version bump, so you can do whichever you like

@daibhin daibhin requested review from a team, hpouillot and oliverb123 June 11, 2025 15:20
@daibhin daibhin merged commit d608deb into master Jun 12, 2025
97 checks passed
@daibhin daibhin deleted the dn-feat/multipart-uploads branch June 12, 2025 08:36
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.

2 participants
0