Skip to content

feat: Add command for uploading frontend sourcemaps [OB-143] #531

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 28 commits into from
May 29, 2025

Conversation

devin-ai-integration[bot]
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented May 14, 2025

Add sourcemaps command for uploading frontend sourcemaps

This PR adds a new sourcemaps command to the LaunchDarkly CLI for uploading JavaScript sourcemaps to LaunchDarkly for error monitoring. The implementation is based on the existing sourcemap uploader in the observability-sdk repository.

Implementation Details

  • Added a new top-level sourcemaps command with an upload subcommand
  • Implemented the sourcemap upload functionality from the TypeScript implementation in Go
  • Added support for the same parameters as the original implementation:
    • --api-key (required): The LaunchDarkly Observability API key
    • --app-version: The current version of your deploy
    • --path: Sets the directory of where the sourcemaps are (defaults to current directory)
    • --base-path: An optional base path for the uploaded sourcemaps
    • --backend-url: An optional backend url for self-hosted deployments

Features

  • Verifies API key validity before attempting uploads
  • Recursively finds all .js.map files in the specified directory
  • Skips node_modules directories when searching for sourcemaps
  • Generates S3 upload URLs for each sourcemap file
  • Uploads sourcemaps to LaunchDarkly's servers
  • Provides progress feedback during the upload process

Testing

  • Verified that the implementation passes all tests in the ldcli repository
  • Manually tested the command functionality

Link to Devin run

https://app.devin.ai/sessions/11aee1380731458dacd92573c687372f

Requested by: [email protected]


Related Jira issue: O11Y-5: create a ldcli sourcemap uploader command

Copy link
Contributor Author

Original prompt from [email protected]:

Repo: launchdarkly/ldcli
Repo: launchdarkly/observability-sdk
File: observability-sdk/sdk/highlight-sourcemap-uploader/src/index.ts

update ldcli to add a new command for uploading frontend sourcemaps to be used with launchdarkly error monitoring. to do this, I essentially want to implement the logic from observability-sdk sourcemap-uploader from index.ts into the CLI.

You only need to look in the following repos: launchdarkly/ldcli, launchdarkly/observability-sdk

Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@Vadman97 Vadman97 changed the title Add sourcemaps command for uploading frontend sourcemaps [OB-143] Add sourcemaps command for uploading frontend sourcemaps May 16, 2025
@Vadman97 Vadman97 changed the title [OB-143] Add sourcemaps command for uploading frontend sourcemaps feat: Add command for uploading frontend sourcemaps [OB-143] May 21, 2025
@Vadman97 Vadman97 requested a review from a team May 22, 2025 15:53
@Vadman97
Copy link
Contributor

validating behavior locally

image

@Vadman97 Vadman97 requested a review from mike-zorn May 23, 2025 03:06
@mike-zorn
Copy link
Contributor

Aside @Vadman97 I made some suggestions that caused code changes. I think it's good to merge, but you'll need to re-test

Copy link
Contributor

@Vadman97 Vadman97 left a comment

Choose a reason for hiding this comment

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

image validated latest behavior is correct

@Vadman97
Copy link
Contributor

addressing feedback raised in https://github.com/launchdarkly/observability/pull/71 to make the authentication strategy more robust (forwarding the access token to highlight to perform the authentication there. let me know if there are any concerns with this approach.

@Vadman97 Vadman97 force-pushed the devin/1747253835-add-sourcemaps-command branch from d30e64a to a891dec Compare May 29, 2025 04:20
@Vadman97
Copy link
Contributor

validated with changes from https://github.com/launchdarkly/observability/pull/71

image

@Vadman97 Vadman97 merged commit 398409c into main May 29, 2025
6 of 7 checks passed
@Vadman97 Vadman97 deleted the devin/1747253835-add-sourcemaps-command branch May 29, 2025 23:48
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.

3 participants