Giter VIP home page Giter VIP logo

Comments (10)

svvitale avatar svvitale commented on September 16, 2024 2

I use a post deploy script for this purpose. Here's the meat of it:

URL_BASE="https://my.website.com"

for js in dist/assets/*.js; do
  # $js has the full path.  Chop it down to just the file name.
  filename=$(basename ${js})

  if [ "$EMBER_ENV" == "production" ]; then
    # Production requires a little more work because of Ember CLI's fingerprinting.
    # First, remove the ember-generated fingerprint and .js extension.  This prefix is common between JS and MAP file.
    filebase=$(expr match "$filename" '\(.*-\)')

    # Find the map file with this prefix.  We take extra care to make sure it's simply the prefix + fingerprint + .map.
    # Without this additional logic, spigotlabs-abcd.map and spigotlabs-frontend-dcba.map would both match while handling
    # spigotlabs-1234.js
    mapfile=$(find dist/assets -regex "dist/assets/${filebase}[0-9a-f]+\.map")
  else
    mapfile=${js%%.js}.map
  fi

  if [ -e ${mapfile} ]; then
    echo "Uploading js/map files to Rollbar: ${filename}, ${mapfile}"
    curl https://api.rollbar.com/api/1/sourcemap \
      -F access_token=${ROLLBAR_ACCESS_TOKEN} \
      -F version=${SOURCE_VERSION} \
      -F minified_url=${URL_BASE}/assets/${filename} \
      -F source_map=@${mapfile}
  fi
done

This could be included in the add-on using the postBuild hook, which would be a nice enhancement.

from ember-cli-rollbar.

Crisfole avatar Crisfole commented on September 16, 2024 1

@NullVoxPopuli Hey, Rollbar support here. You'll need to setup the correct additional parameters in your rollbar configuration: https://rollbar.com/docs/source-maps/.

from ember-cli-rollbar.

davewasmer avatar davewasmer commented on September 16, 2024

I don't have a ton of free cycles at the moment to tackle this, but PRs are welcome :) Otherwise, I'll take a stab when I find some time.

from ember-cli-rollbar.

wcurtis avatar wcurtis commented on September 16, 2024

You and me both - race ya :D

from ember-cli-rollbar.

davewasmer avatar davewasmer commented on September 16, 2024

@wcurtis I dug into those docs, and Rollbar's recommended approach to handling source maps is to upload the source map files on every deploy (which is well outside the scope of this addon). If you do that, then all you need is to enable a couple options in the Rollbar config (which is currently supported via ENV.rollbar). So it seems this is currently possible, unless I'm misunderstanding their docs?

from ember-cli-rollbar.

wcurtis avatar wcurtis commented on September 16, 2024

We ended up enabling source maps through ember-cli and all worked as expected 👍

http://www.ember-cli.com/

Sourcemaps are enabled by default in dev, to enable them in production pass {sourcemaps: { enabled: true, extensions: ['js']}} to your EmberApp constructor.

No change to this addon needed - will close it out.

from ember-cli-rollbar.

davewasmer avatar davewasmer commented on September 16, 2024

Glad to hear it! Thanks for the update

from ember-cli-rollbar.

NullVoxPopuli avatar NullVoxPopuli commented on September 16, 2024

@wcurtis how did you get rollbar to recognize source maps? I don't even know if mine are uploaded.

in ember-cli-build.js, I have sourcemaps: { enabled: true }

from ember-cli-rollbar.

NullVoxPopuli avatar NullVoxPopuli commented on September 16, 2024

but how do I set all that with ember-cli-rollbar?

I don't know if the deploy fingerprint is accessible in my environment.js (where rollbar is configured)

and the docs show snake_cased config, whereas ember-cli-rollbar is camelCase :-\

from ember-cli-rollbar.

NullVoxPopuli avatar NullVoxPopuli commented on September 16, 2024

my sourcemaps are getting uploaded -
image

I guess, now there needs to be a way to configure deploy.js to point to whichever one of those is correct?

from ember-cli-rollbar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.