Skip to main content
A minified JavaScript file can put many source lines on one line. A stack frame from that file points to a generated line and column. A source map connects that position to the original file, line, and column. This guide uses the Vite plugin in @logbrew/sdk 0.1.33. You need a Vite app, access to its build output, and permission to create a project key. For Apple debug files, see Apple crashes and hangs.

Keep the build and the events together

Use the same project, release, environment, and service for the upload and for the app’s runtime events. See Releases for version names. This guide uses web@1.2.3, staging, and checkout-web. Change the release when the built code changes. Upload the prepared build, then deploy that same build. Do not rebuild or change its JavaScript after upload.

Add the Vite plugin

Install the SDK in the app directory:
Add the plugin to vite.config.js. Keep your other plugins and build settings. Replace the project ID:
minifiedPathPrefix is the deployed URL of the build directory. The plugin adds each file’s path in that directory. For example, dist/assets/app.js becomes https://app.example.com/assets/app.js. If you serve the build at /web, include /web in the prefix. Do not add /assets to the prefix. Without an upload option, the plugin sends nothing to LogBrew. It also:
  • Sets build.sourcemap to "hidden" when you do not set it. If you set it to false, change it to "hidden".
  • Keeps function names when you do not set minifier options. If you set your own, keep names there.
Hidden source maps stay in the build output as normal files. They are not access-controlled. Do not use inline source maps. The plugin does not accept a map inside the JavaScript file.

Build and check locally

Run the production build:
The plugin gives each JavaScript file and its source map the same Debug ID. It removes embedded sourcesContent and the local app-root path. It writes dist/logbrew-release-artifacts.json. Open the manifest. Make sure that validation.status is ready and that it lists this build’s files and deployed URLs. Hidden maps cause a sourceMappingURL comment missing warning. That warning is expected. Do not upload a map that contains a private path or source text you do not want to share. The upload also contains the compiled JavaScript, so keep secrets out of the app bundle. LogBrew rejects a source map that has 5,000,000 or more segments, sources, and names in total. Split a very large bundle into smaller chunks. Upload the map of each chunk. Check the upload locally. This command sends no request and needs no key:
Continue only when the command exits with code 0 and prints "status": "dry_run". This checks the local files and manifest. It does not test the server. If your build uses another output directory, change both paths. To check a mapping, run the built app and copy one generated stack frame with its file, line, and column:
Make sure the result has "status": "resolved". The original object shows the source file, line, and column. This command runs locally and uploads nothing.

Create an artifact key

Sign in with the LogBrew CLI. Find the project ID:
Create an artifact key for the project. Use a new file path in an owner-only directory:
Continue only after the command succeeds. If the result is unclear, run the same command again with the same arguments. Do not use --abandon-retry. An artifact key is project-scoped and write-only. It uploads source maps and debug files. It cannot send telemetry or read artifact metadata. Do not use an account credential or a runtime SDK key in its place. Store the key as LOGBREW_RELEASE_ARTIFACT_TOKEN in your build environment’s secret settings. Do not print or commit it. Do not put it in a client-visible variable, such as VITE_* or EXPO_PUBLIC_*. Set the variable in the process that runs the upload. The helper does not read .env files. Vite does not load them into process.env during config evaluation.

Upload the prepared build

Use the same checked files and manifest. This command sends the upload to LogBrew:
"status": "uploaded" shows that LogBrew accepted the upload. If the command exits with an error, stop and use the table below. The helper retries a network error, 408, 429, or a 5xx response up to 2 times. It sends the same prepared files each time. Use --max-retries to change the count. After the manual upload works, you can upload during the Vite build instead. Add this option to the plugin configuration:
Use one upload method. The plugin stops the build on a preparation or upload error. Add dryRun: true to test without an upload. The plugin does not delete source maps from the output directory. Do not deploy .map files or the manifest to the public website or CDN. To map a frame from a captured issue, run symbolicate-js with that frame against the same prepared build.

Read a new issue

Deploy the same prepared build to the test environment. Cause one safe test error through your issue capture path. Do not send user input, credentials, or a raw stack for this test. Find the new issue with the same project and build context:
Copy the issue ID from the result. Read its latest occurrence:
Read the event time, project, service, environment, and release first. Then read event.stack_frames. A frame with source: "symbolicated" has the original file, line, and column from your upload. A frame with source: "captured" has the location that the app sent. logbrew read issue "<issue_id>" --json also returns a symbolication object. Each frame in it has a status: resolved, artifact_not_found, source_not_resolved, invalid_metadata, or unavailable. Only a resolved frame has an original location. LogBrew maps frames when you read the issue. An upload after the error can map an earlier event that has the same Debug ID. A mapped frame points to code to examine. It does not show what caused the error. See Investigate an issue for the other fields.

Recover from a failed check

Keep source files, keys, and private paths out of support messages. See Troubleshooting and API errors.