Giter Club home page Giter Club logo

Comments (8)

lforst avatar lforst commented on June 21, 2024 1

the official plugin uploads batched

from sentry-javascript-bundler-plugins.

CodySchaaf avatar CodySchaaf commented on June 21, 2024 1

I might have solved it by investigating your suggestion or using a relative path. Just deleted the append option and let the plugins do their thing. Still need to verify in prod. Thanks for your help.

from sentry-javascript-bundler-plugins.

lforst avatar lforst commented on June 21, 2024

Hi, webpack-sentry-plugin is not maintained by Sentry. If you have an issue with it, please open one over at their repo https://github.com/40thieves/webpack-sentry-plugin.

Or you can use the official Sentry webpack plugin: https://www.npmjs.com/package/@sentry/webpack-plugin

from sentry-javascript-bundler-plugins.

CodySchaaf avatar CodySchaaf commented on June 21, 2024

Hi, webpack-sentry-plugin is not maintained by Sentry. If you have an issue with it, please open one over at their repo https://github.com/40thieves/webpack-sentry-plugin.

Or you can use the official Sentry webpack plugin: https://www.npmjs.com/package/@sentry/webpack-plugin

Oh, embarrassing. Thank you, I will switch to the official.

from sentry-javascript-bundler-plugins.

CodySchaaf avatar CodySchaaf commented on June 21, 2024

@lforst Is this likely to be a nonissue with the official plugin?

from sentry-javascript-bundler-plugins.

CodySchaaf avatar CodySchaaf commented on June 21, 2024

@lforst sorry, hopefully last question, and apologies if this is the wrong place for these questions. Trying to get the new plugin running, and a lot of the documentation around this specific issue seems to point to legacy implementations. Quick question about how to transform the old plugin usage from the following:

Original Implementation

      new SentryPlugin({
        organisation: 'org-name',
        project: process.env.SENTRY_PROJECT_NAME,
        apiKey: process.env.SENTRY_API_KEY,
        filenameTransform: (filename) => `~/assets/react/${filename}`,
        release: (hash) => process.env.SOURCE_VERSION || hash,
        suppressConflictError: true
      }),
    // Creates sourcemaps and customizes the directive
    new webpack.SourceMapDevToolPlugin({
      filename: '[file].map',
      append: '\n//# sourceMappingURL=/assets/react/[url]',
      exclude: /vendor_bundle|DateFnsLocale-es/
    })

My first attempt worked in test environments, but on prod (because we use a CDN) the asset didn't match.

The path for this stack frame is https://example.cloudfront.net/assets/react/client_bundle.e375ad82cbb523fbebc5.js and the release value for this event is *****.

Sentry was not able to find a file in the release's artifacts that matches one of the following paths:

https://example.cloudfront.net/assets/react/client_bundle.e375ad82cbb523fbebc5.js
~/assets/react/client_bundle.e375ad82cbb523fbebc5.js

While the artifact bundle has:

Sourcemap Reference: /assets/react/client_bundle.e375ad82cbb523fbebc5.js.map

Failed Implementation

sentryWebpackPlugin({
        org: 'org-name',
        project: process.env.SENTRY_PROJECT_NAME,
        authToken: process.env.SENTRY_AUTH_TOKEN,
        release: { name: process.env.SOURCE_VERSION }
      }),
    // Creates sourcemaps and customizes the directive
    new webpack.SourceMapDevToolPlugin({
      filename: '[file].map',
      append: '\n//# sourceMappingURL=/assets/react/[url]',
      exclude: /vendor_bundle|DateFnsLocale-es/
    })

Note the append: '\n//# sourceMappingURL=/assets/react/[url]', in the second plugin.

For my next try, I updated that to append: '\n//# sourceMappingURL=~/assets/react/[url]', with a ~/. Is this the recommended way to handle this? Which I have not deployed yet.

I noticed that a lot of the issues around this issue talked about urlPrefix but that appears to be in the legacy version.

There are also sourcemaps.rewriteSources and rewriteFramesIntegration but I was a little unclear on whether those were meant to address this issue, or if my update above was enough...before I break Prod again.

from sentry-javascript-bundler-plugins.

lforst avatar lforst commented on June 21, 2024

/assets/react/client_bundle.e375ad82cbb523fbebc5.js.map is technically incorrect because it is an absolute path. I assume you don't actually have your assets live under this absolute path.

If you change the sourceMappingUrl to a relative path pointing to the source map from the source file, everything should work.

from sentry-javascript-bundler-plugins.

CodySchaaf avatar CodySchaaf commented on June 21, 2024

Our assets are stored in a flat structure in an s3 bucket named assets/react so on prod all the built code can be found at https://example.cloudfront.net/assets/react/ so for example https://example.cloudfront.net/assets/react/client_bundle.205ea7def2e26d2f79f8.js and https://example.cloudfront.net/assets/react/vendor_bundle.a7c14cf7e074571d2905.js regardless of current page path. Is that what you mean?

from sentry-javascript-bundler-plugins.

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.