vite_ruby icon indicating copy to clipboard operation
vite_ruby copied to clipboard

Sentry Source Maps Not Uploading Properly with vite-plugin-ruby

Open ghost opened this issue 10 months ago • 1 comments

  • [x ] I have tried upgrading by running bundle update vite_ruby.
  • [ ] I have read the troubleshooting section before opening an issue.

Description 📖

I’m using vite-plugin-ruby with @sentry/vite-plugin to upload source maps for my Rails + Vite application, but the source maps are not being properly detected or linked in Sentry.

Reproduction 🐞

Set up vite.config.mts:

import { sentryVitePlugin } from "@sentry/vite-plugin";
import { defineConfig } from 'vite'
import RubyPlugin from 'vite-plugin-ruby'

export default defineConfig({
  plugins: [
    RubyPlugin(),
    sentryVitePlugin({
      org: "reelon-technologies-pvt-ltd",
      project: "reelon",
      authToken: process.env.SENTRY_AUTH_TOKEN,
    })
  ],
  build: {
    sourcemap: true
  }
})

Initialize Sentry in app/javascript/application.js:

import * as Sentry from "@sentry/browser";

Sentry.init({
  dsn: process.env.SENTRY_DSN,
  integrations: [
    Sentry.replayIntegration({
      maskAllText: false,
      blockAllMedia: false,
    }),
  ],
  replaysSessionSampleRate: 0.1,
  replaysOnErrorSampleRate: 1.0,
  tracesSampleRate: 1.0,
});
console.log("✅ Sentry initialized on frontend with Replay");
Vite Ruby Info

Run bin/rake vite:info and provide the output:

bin/vite present?: true
vite_ruby: 3.9.1
vite_rails: 3.0.19
rails: 8.0.1
ruby: ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [arm64-darwin24]
node: v20.17.0
npm: 10.8.2

installed packages:
jumpstart-app@ /Users/georgelgabrielgiroe/developer/make_software/reelon
├─┬ [email protected]
│ └── [email protected] deduped
└── [email protected]

Logs 📜

If not providing a reproduction:

Output

Run DEBUG=vite-plugin-ruby:* bin/vite dev or DEBUG=vite-plugin-ruby:* bin/vite build and provide the output:

bin/vite build                                                            ─╯
Building with Vite ⚡️
[sentry-vite-plugin] Info: Using environment variables configured in ".env.sentry-build-plugin".
vite v6.0.11 building for production...
[sentry-vite-plugin] Info: Sending telemetry data on issues and performance to Sentry. To disable telemetry, set `options.telemetry` to `false`.
transforming...
✓ 2 modules transformed.
rendering chunks...
computing gzip size...
../../public/vite/.vite/manifest-assets.json      0.00 kB │ gzip: 0.02 kB
../../public/vite/.vite/manifest.json             0.19 kB │ gzip: 0.12 kB
../../public/vite/assets/application-CwCkNKtt.js  0.69 kB │ gzip: 0.40 kB │ map: 1.12 kB
> Found 2 files
> Analyzing 2 sources
> Adding source map references
> Bundled 2 files for upload
> Bundle ID: 44e604f0-80c8-59a3-933b-207a0f15296a
> Uploaded files to Sentry
> File upload complete (processing pending on server)
> Organization: reelon-technologies-pvt-ltd
> Project: reelon
> Release: 6600a9d66521a86208c43671bbdc8ad958cbb108
> Dist: None
> Upload type: artifact bundle

Source Map Upload Report
  Scripts
    ~/26562f37-4db8-4dd8-a8a4-12e0bdea2a74-0.js (sourcemap at application-CwCkNKtt.js.map, debug id 26562f37-4db8-4dd8-a8a4-12e0bdea2a74)
  Source Maps
    ~/26562f37-4db8-4dd8-a8a4-12e0bdea2a74-0.js.map (debug id 26562f37-4db8-4dd8-a8a4-12e0bdea2a74)
[sentry-vite-plugin] Info: Successfully uploaded source maps to Sentry
✓ built in 3.36s
Build with Vite complete: /Users/georgelgabrielgiroe/developer/make_software/reelon/public/vite
Any insights or guidance on how to properly configure vite-plugin-ruby for source map uploads would be greatly appreciated.🙏

Screenshots 📷

Provide console or browser screenshots of the problem.

ghost avatar Feb 24 '25 18:02 ghost

Having the same issue

bin/vite present?: true
vite_ruby: 3.9.1
vite_rails: 3.0.17
rails: 7.0.8.4
ruby: ruby 3.2.4 (2024-04-23 revision af471c0e01) [arm64-darwin24]
node: v22.11.0
yarn: 1.22.19

installed packages:
@[email protected]
├─┬ @storybook/[email protected]
│ ├─┬ @storybook/[email protected]
│ │ └── [email protected] deduped
│ └── [email protected] deduped
├─┬ @vitejs/[email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
└── [email protected]

babutabhavya avatar Mar 11 '25 12:03 babutabhavya