question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inject commit SHA or bundle ID into FAB, for things like Rollbar

See original GitHub issue

In https://github.com/bitgenics/linc/issues/14 @qnm mentioned he needs a way to set a unique value for Rollup that changes whenever the Javascript source changes.

Right now the work-around is to use the repository tree_id, but that isn’t ideal, because now the bundle changes on every repository change, even if that change never got into the bundle.

With a pre-package hook in fab-compile we could do something like calculate a checksum of the client JavaScript assets and set that as a id in the settings.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
evanderkooghcommented, Jul 21, 2020

Oh yeah, loading sourcemaps at runtime is absolutely a terrible idea 😃

The problem is that a bundle_id is a hash of the entire FAB, so can only be made after the entire FAB has been built, which is well after webpack finished.

So I think the ideal solution would be to generate the sourcemaps during built, figure out the bundle_id after FAB is built and upload them to Rollbar with the bundle_id. And then use the ServerContext.bundle_id to pass that on to HTML.

That will also bundle your errors for commits where the code was actually the same.

But it will probably be easier to just get the commit_sha during build and use that as normal.

I’ll try to find some time to sit with @geelen to see if it is possible to capture this logic in a FAB plugin. Would be great to be able to solve this for any FAB once and for all 😃

0reactions
qnmcommented, Jul 21, 2020

This is for sourcemaps, so for context the process is roughly this:

  1. build occurs, assets are created, including sourcemaps
  2. we pick a unique id, could be a built identifier, or a git SHA
  3. sourcemaps are loaded into Rollbar using e.g. curl or https://github.com/thredup/rollbar-sourcemap-webpack-plugin, containing the the ID in (2) as part of the payload
  4. rollbar runtime is configured using the same id in (2). this allows the running code to be associated with the correct source map

How can I have an ID available at both compile-time and run-time?

I’m assuming that loading source maps into Rollbar at run-time is a bad idea.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source Control Integration - Rollbar Docs
View commits in each deploy. When a Rollbar project is connected to a git repository, the list of commits included in each deploy...
Read more >
Untitled
Chemical interferences in aas, Visiting santa nyc, 2015 yamaha 1300, Mariachi clasico ... Online money earning sites bd, Anti roll bar link renault...
Read more >
Untitled
Navy sister items, Manga tsubasa online, 3126 conflans rd irving tx 75061, ... in pakistan, Plc based control panels in nagpur, Pewdiepie fabulous...
Read more >
npmsearchfullcat_npm143.txt - GitHub
=dfellis 2012-07-13 0.1.2 2gis A simple way to use the 2GIS API from Node.js =andreychizh ... Emit custom events from an input so...
Read more >
Awesome Ruby
Webpacker - Use Webpack to manage app-like JavaScript modules in Rails. ... Surrounded - Encapsulated related objects in a single system to add...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found