Skip to content

vertragswecker/heroku-buildpack-source-maps-uploader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Source maps uploader

This is a tiny build pack to run after the javascript assets are compiled, and source maps are generated to upload it to Rollbar, so we can have the source maps available before the first error occurrence.

Usage

Add the build pack to your application:

heroku buildpacks:add volders/source-maps-uploader

After that, you need activate the dyno metadata for your app. During the build we have the SOURCE_VERSION env variable. However, we need the HEROKU_SLUG_COMMIT when the application is running to set the code_version option.

Next, add the following environment variables to your app:

  • ROLLBAR_POST_SERVER_TOKEN: your post_server_item Rollbar token found in your project access tokens settings page found here: Settings → Project Access Tokens (https://rollbar.com/volders/<the-project-name>/settings/access_tokens.
  • SOURCE_MAPS_BASE_URL: the application base URL where the assets are served. For example my-url.com/assets.

Then, add a .source-maps-uploader file in the root of your repository with the path to where the source maps are. For example:

public/assets

In the next deployment, you should see the uploaded files in the build log:

...
-----> Uploading source maps...
       Uploading file public/assets/application-ef490583af6aebb9bf03.js.map
       Uploading file public/assets/other-bc62c70ba43856d88229.js.map
       Source maps uploading completed
...

And on the Rollbar source maps page from the project: https://rollbar.com/volders/<the-project-name>/settings/source_map.

Note: This build pack does not work out of the box for the review apps because we can't activate the dyno metadata using the app.json. To use it in a review app, you must manually activate the dyno metadata and set the SOURCE_MAPS_BASE_URL to the correct review app address.

License

Copyright 2022 Volders GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Heroku buildpack for uploading source map files to Rollbar

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages