getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
8.02k stars 1.59k forks source link

filesToDeleteAfterUpload : Could not determine source map path (Gatsby) #13582

Open julianCast opened 2 months ago

julianCast commented 2 months ago

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/gatsby

SDK Version

8.28.0

Framework Version

React 18.3.1, Gatsby 5.11, webpack-plugin 2.22.3

Reproduction Example/SDK Setup

Sentry.init({
  dsn: "https://123.ingest.sentry.io/123",
  sampleRate: hostingEnv === "production" ? 0.5 : 1,
  environment: hostingEnv || "development",
  enabled: !!hostingEnv,
  beforeSend(event) {
    const ev = { ...event };
    // Check if Cypress is running and add tags if it is
    if (hostingEnv !== "production" && typeof window !== "undefined" && window.Cypress) {
      const tags = {
        e2e_test: "yes",
        test_name: window.Cypress.currentTest.title,
      };

      // Add Cypress-specific tags to the event
      ev.tags = {
        ...event.tags,
        ...tags,
      };
    }
    // Return the event to send it to Sentry
    return ev;
  },
});

gatsby-node.js

 actions.setWebpackConfig({
     devtool: "source-map",
    plugins: [
      sentryWebpackPlugin({
        debug: true,
        sourcemaps: {
          // Only include files from the build output directory
          assets: ['./public/**'],
          filesToDeleteAfterUpload: "./public/**/*.map",
          // Ignore files that aren't users' source code related
          ignore: [
            'polyfill-*', // related to polyfills
            'framework-*', // related to the frameworks (e.g. React)
            'webpack-runtime-*', // related to Webpack
          ],
        },

Netlify logs

4:01:00 PM: [sentry-webpack-plugin] Info: Sending telemetry data on issues and performance to Sentry. To disable telemetry, set `options.telemetry` to `false`.
4:01:09 PM: warning `isModuleDeclaration` has been deprecated, please migrate to `isImportOrExportDeclaration`
4:01:09 PM:     at isModuleDeclaration (/opt/build/repo/packages/pk1/node_modules/@babel/types/lib/validators/generated/index.js:2748:35)
4:01:09 PM:     at PluginPass.Program (/opt/build/repo/packages/pk1/node_modules/babel-plugin-lodash/lib/index.js:102:44)
4:01:28 PM: [sentry-webpack-plugin] Debug: Could not determine source map path for bundle: /opt/build/repo/packages/pk1/public/134cc78d375779d56b59f9cf0b87b11e235b00c3-0d6adfc9d3b5985ec641.js - Did you turn on source map generation in your bundler?
4:01:28 PM: [sentry-webpack-plugin] Debug: Could not determine source map path for bundle: /opt/build/repo/packages/pk1/public/134cc78d375779d56b59f9cf0b87b11e235b00c3-aaa39673517b266fed67.js - Did you turn on source map generation in your bundler?
...
4:01:28 PM: [sentry-webpack-plugin] Debug: Could not determine source map path for bundle: /opt/build/repo/packages/pk1/public/731-06521c24082f25533fd7.js - Did you turn on source map generation in your bundler?
4:01:28 PM: [sentry-webpack-plugin] Debug: Could not determine source map path for bundle: /opt/build/repo/packages/pk1/public/731-7daedd39df15f3dc44c1.js - Did you turn on source map generation in your bundler?
4:01:28 PM: [sentry-webpack-plugin] Debug: Could not determine source map path for bundle: /opt/build/repo/packages/pk1/public/843-18addac4551a6e164094.js - Did you turn on source map generation in your bundler?
4:01:28 PM: [sentry-webpack-plugin] Debug: Could not determine source map path for bundle: /opt/build/repo/packages/pk1/public/731-7c77df399f7448a2620b.js - Did you turn on source map generation in your bundler?
4:01:28 PM: [sentry-webpack-plugin] Debug: Could not determine debug ID from bundle. This can happen if you did not clean your output folder before installing the Sentry plugin. File will not be source mapped: /opt/build/repo/packages/pk1/public/~partytown/debug/partytown-atomics.js
4:01:28 PM: [sentry-webpack-plugin] Debug: Could not determine source map path for bundle: /opt/build/repo/packages/pk1/public/webpack-runtime-99a9658d0e0fe7f4c016.js - Did you turn on source map generation in your bundler?
4:01:28 PM: [sentry-webpack-plugin] Debug: Could not determine debug ID from bundle. This can happen if you did not clean your output folder before installing the Sentry plugin. File will not be source mapped: /opt/build/repo/packages/pk1/public/~partytown/debug/partytown-media.js
4:01:28 PM: [sentry-webpack-plugin] Debug: Could not determine debug ID from bundle. This can happen if you did not clean your output folder before installing the Sentry plugin. File will not be source mapped: /opt/build/repo/packages/pk1/public/~partytown/debug/partytown-sandbox-sw.js
4:01:28 PM: [sentry-webpack-plugin] Debug: Could not determine source map path for bundle: /opt/build/repo/packages/pk1/public/webpack-runtime-aa495f4b25d3bca63075.js - Did you turn on source map generation in your bundler?
4:01:28 PM: [sentry-webpack-plugin] Debug: Could not determine debug ID from bundle. This can happen if you did not clean your output folder before installing the Sentry plugin. File will not be source mapped: /opt/build/repo/packages/pk1/public/~partytown/debug/partytown-sw.js
4:01:28 PM: [sentry-webpack-plugin] Debug: Could not determine source map path for bundle: /opt/build/repo/packages/pk1/public/webpack-runtime-cbe9da021499d31840f2.js - Did you turn on source map generation in your bundler?
4:01:28 PM: [sentry-webpack-plugin] Debug: Could not determine debug ID from bundle. This can happen if you did not clean your output folder before installing the Sentry plugin. File will not be source mapped: /opt/build/repo/packages/pk1/public/~partytown/debug/partytown-ww-atomics.js
4:01:28 PM: [sentry-webpack-plugin] Debug: Could not determine debug ID from bundle. This can happen if you did not clean your output folder before installing the Sentry plugin. File will not be source mapped: /opt/build/repo/packages/pk1/public/~partytown/debug/partytown-ww-sw.js
4:01:28 PM: > Found 102 files
4:01:28 PM: > Analyzing 102 sources
4:01:28 PM: > Adding source map references
4:01:30 PM: > Bundled 102 files for upload
4:01:30 PM: > Bundle ID: 122552c2-c5c5-59b7-bdde-c4c385a47f6b
4:01:31 PM: > Uploaded files to Sentry
4:01:31 PM: > File upload complete (processing pending on server)
4:01:31 PM: > Organization: project-alfa
4:01:31 PM: > Project: project1-website
4:01:31 PM: > Release: 712adf389b627eb30d20b95b94c10f0f54a503a4
4:01:31 PM: > Dist: None
4:01:31 PM: > Upload type: artifact bundle
4:01:31 PM: Source Map Upload Report
4:01:31 PM:   Scripts
4:01:31 PM:     ~/0020974e-0c4f-46e6-b1e4-7c70205b9295-36.js (sourcemap at component---src-templates-404-tsx-4e42cab8bf44d5e7f930.js.map, debug id 0020974e-0c4f-46e6-b1e4-7c70205b9295)
4:01:31 PM:     ~/008d98f3-7381-49db-be4e-2839552b3e36-54.js (sourcemap at component---src-templates-checkout-tsx-f6293a3ceb7f8d6a962b.js.map, debug id 008d98f3-7381-49db-be4e-2839552b3e36)
4:01:31 PM:     ~/054a242b-139e-4dbe-a14d-0f762824c93a-80.js (sourcemap at webpack-runtime-1fc114a7886a53728557.js.map, debug id 054a242b-139e-4dbe-a14d-0f762824c93a)
4:01:31 PM:     ~/0620bb0e-f73b-48ec-b752-c57160fb1b05-50.js (sourcemap at component---src-templates-checkout-tsx-12161fc7476d53db40e9.js.map, debug id 0620bb0e-f73b-48ec-b752-c57160fb1b05)
4:01:31 PM:     ~/168ec1fd-8f8e-46ce-9d4f-3c9f4c11f86b-51.js (sourcemap at component---src-templates-checkout-tsx-786ff7d7167e3e83fc6c.js.map, debug id 168ec1fd-8f8e-46ce-9d4f-3c9f4c11f86b)
4:01:31 PM:     ~/17bd1b5e-084d-4e0b-ad0c-ec5af4d051aa-30.js (sourcemap at c858cb5526ea6f403310ae7e6e4136d168011988-05efa6a9ed5c701f2ef5.js.map, debug id 17bd1b5e-084d-4e0b-ad0c-ec5af4d051aa)
4:01:31 PM:     ~/17bd1b5e-084d-4e0b-ad0c-ec5af4d051aa-31.js (sourcemap at c858cb5526ea6f403310ae7e6e4136d168011988-258bd26c98d0f60f79b3.js.map, debug id 17bd1b5e-084d-4e0b-ad0c-ec5af4d051aa)
4:01:31 PM:     ~/17bd1b5e-084d-4e0b-ad0c-ec5af4d051aa-32.js (sourcemap at c858cb5526ea6f403310ae7e6e4136d168011988-a8ca8d535582f38b22b3.js.map, debug id 17bd1b5e-084d-4e0b-ad0c-ec5af4d051aa)
4:01:31 PM:     ~/17bd1b5e-084d-4e0b-ad0c-ec5af4d051aa-33.js (sourcemap at c858cb5526ea6f403310ae7e6e4136d168011988-aefc4a2a25182909129c.js.map, debug id 17bd1b5e-084d-4e0b-ad0c-ec5af4d051aa)
4:01:31 PM:     ~/190e5a06-07ed-49c8-a6f9-264544b4a974-5.js (sourcemap at 48251b2bc10c1b7a2503c92c2f0c3ebf831c80d9-4440eb0b69f3076dbed8.js.map, debug id 190e5a06-07ed-49c8-a6f9-264544b4a974)
4:01:31 PM:     ~/190e5a06-07ed-49c8-a6f9-264544b4a974-6.js (sourcemap at 48251b2bc10c1b7a2503c92c2f0c3ebf831c80d9-47a2398ad02414dd7768.js.map, debug id 190e5a06-07ed-49c8-a6f9-264544b4a974)
4:01:31 PM:     ~/f54b2694-18bb-4bd3-ab49-a276bc9c1cc4-72.js (sourcemap at f54fff4d57324dce737b6c8eac6550faad39afa8-9f2e6b605fe3770e44bd.js.map, debug id f54b2694-18bb-4bd3-ab49-a276bc9c1cc4)
4:01:31 PM:     ~/f54b2694-18bb-4bd3-ab49-a276bc9c1cc4-73.js (sourcemap at f54fff4d57324dce737b6c8eac6550faad39afa8-c96a61651340afcba998.js.map, debug id f54b2694-18bb-4bd3-ab49-a276bc9c1cc4)
4:01:31 PM:     ~/f6d49f37-4072-46e9-a459-ebdd41d00c6d-60.js (sourcemap at component---src-templates-post-tsx-0a3378756239ed5aed5c.js.map, debug id f6d49f37-4072-46e9-a459-ebdd41d00c6d)
4:01:31 PM:     ~/f6d49f37-4072-46e9-a459-ebdd41d00c6d-62.js (sourcemap at component---src-templates-post-tsx-9ccf509bbdf8ffedcecd.js.map, debug id f6d49f37-4072-46e9-a459-ebdd41d00c6d)
4:01:31 PM:     ~/f6d49f37-4072-46e9-a459-ebdd41d00c6d-63.js (sourcemap at component---src-templates-post-tsx-a68aac43cbfb75bec9df.js.map, debug id f6d49f37-4072-46e9-a459-ebdd41d00c6d)
4:01:31 PM:   Source Maps
4:01:31 PM:     ~/054a242b-139e-4dbe-a14d-0f762824c93a-80.js.map (debug id 054a242b-139e-4dbe-a14d-0f762824c93a)
4:01:31 PM:     ~/17bd1b5e-084d-4e0b-ad0c-ec5af4d051aa-31.js.map (debug id 17bd1b5e-084d-4e0b-ad0c-ec5af4d051aa)
4:01:31 PM:     ~/190e5a06-07ed-49c8-a6f9-264544b4a974-9.js.map (debug id 190e5a06-07ed-49c8-a6f9-264544b4a974)
4:01:31 PM:     ~/199904a5-357f-43fc-aa3d-4c101848b43c-20.js.map (debug id 199904a5-357f-43fc-aa3d-4c101848b43c)
4:01:31 PM:     ~/41a4c4c9-bb80-46ad-96bb-3c7e92f555cb-79.js.map (debug id 41a4c4c9-bb80-46ad-96bb-3c7e92f555cb)
4:01:31 PM:     ~/4ca9a543-a191-49d5-9f9e-5eb283febfbc-46.js.map (debug id 4ca9a543-a191-49d5-9f9e-5eb283febfbc)
4:01:31 PM:     ~/6673c8e6-e273-4dc9-8ccb-fbc80bfb9e5e-43.js.map (debug id 6673c8e6-e273-4dc9-8ccb-fbc80bfb9e5e)
4:01:31 PM:     ~/6d45f8a4-05b2-4eec-a047-2ac16b0188e6-11.js.map (debug id 6d45f8a4-05b2-4eec-a047-2ac16b0188e6)
4:01:31 PM:     ~/76f08133-2730-4d16-854e-ebac73fc781d-53.js.map (debug id 76f08133-2730-4d16-854e-ebac73fc781d)
4:01:31 PM:     ~/88f61b2a-26e8-486d-9bab-c2964462ca09-37.js.map (debug id 88f61b2a-26e8-486d-9bab-c2964462ca09)
4:01:31 PM:     ~/8e3a1930-143a-47b3-8d70-1c319f18e6f9-28.js.map (debug id 8e3a1930-143a-47b3-8d70-1c319f18e6f9)
4:01:31 PM:     ~/9b1fbd94-8c35-4d77-8443-cf0c8f7db0f7-1.js.map (debug id 9b1fbd94-8c35-4d77-8443-cf0c8f7db0f7)
4:01:31 PM:     ~/c9ef4f16-d9dd-416c-8862-7709a3ec10ee-68.js.map (debug id c9ef4f16-d9dd-416c-8862-7709a3ec10ee)
4:01:31 PM:     ~/ca509d9f-5ec2-4e73-8424-a77fb3f43847-58.js.map (debug id ca509d9f-5ec2-4e73-8424-a77fb3f43847)
4:01:31 PM:     ~/e05e2876-15b8-417a-bb83-b4141e7e8387-16.js.map (debug id e05e2876-15b8-417a-bb83-b4141e7e8387)
4:01:31 PM:     ~/f54b2694-18bb-4bd3-ab49-a276bc9c1cc4-70.js.map (debug id f54b2694-18bb-4bd3-ab49-a276bc9c1cc4)
4:01:31 PM:     ~/f6d49f37-4072-46e9-a459-ebdd41d00c6d-63.js.map (debug id f6d49f37-4072-46e9-a459-ebdd41d00c6d)
4:01:31 PM: [sentry-webpack-plugin] Info: Successfully uploaded source maps to Sentry
4:01:31 PM: [sentry-webpack-plugin] Debug: Waiting for dependencies on generated files to be freed before deleting...
4:01:31 PM: [sentry-webpack-plugin] Debug: Deleting asset after upload: /opt/build/repo/packages/pk1/public/webpack-runtime-1fc114a7886a53728557.js.map
4:01:31 PM: [sentry-webpack-plugin] Debug: Deleting asset after upload: /opt/build/repo/packages/pk1/public/framework-f88b32f0f260d805ebc1.js.map
4:01:31 PM: [sentry-webpack-plugin] Debug: Deleting asset after upload: /opt/build/repo/packages/pk1/public/f54fff4d57324dce737b6c8eac6550faad39afa8-024aaa05e66437425035.js.map
4:01:31 PM: [sentry-webpack-plugin] Debug: Deleting asset after upload: /opt/build/repo/packages/pk1/public/component---src-templates-root-tsx-da045aae51f3261e87d2.js.map
4:01:31 PM: [sentry-webpack-plugin] Debug: Deleting asset after upload: /opt/build/repo/packages/pk1/public/component---src-templates-post-tsx-a68aac43cbfb75bec9df.js.map
4:01:31 PM: [sentry-webpack-plugin] Debug: Deleting asset after upload: /opt/build/repo/packages/pk1/public/component---src-templates-page-tsx-a1d5a4ecb32f153d406f.js.map
4:01:31 PM: [sentry-webpack-plugin] Debug: Deleting asset after upload: /opt/build/repo/packages/pk1/public/component---src-templates-checkout-tsx-b31bf09986d41ce9aa3c.js.map
4:01:31 PM: [sentry-webpack-plugin] Debug: Deleting asset after upload: /opt/build/repo/packages/pk1/public/component---src-templates-app-tsx-633bd87f7b30f64907ba.js.map
4:01:31 PM: [sentry-webpack-plugin] Debug: Deleting asset after upload: /opt/build/repo/packages/pk1/public/component---src-templates-accessory-checkout-tsx-ba5f01e1b0bae543c2ec.js.map
4:01:31 PM: [sentry-webpack-plugin] Debug: Deleting asset after upload: /opt/build/repo/packages/pk1/public/134cc78d375779d56b59f9cf0b87b11e235b00c3-61426bb564cb682e101b.js.map
4:01:40 PM: Webpack Bundle Analyzer saved stats file to /opt/build/repo/packages/pk1/public/stats.json
4:01:40 PM: success Building production JavaScript and CSS bundles - 39.702s
4:01:40 PM: [sentry-webpack-plugin] Info: Sending telemetry data on issues and performance to Sentry. To disable telemetry, set `options.telemetry` to `false`.
4:01:56 PM: [sentry-webpack-plugin] Debug: Could not determine source map path for bundle: /opt/build/repo/packages/pk1/public/134cc78d375779d56b59f9cf0b87b11e235b00c3-0d6adfc9d3b5985ec641.js - Did you turn on source map generation in your bundler?
4:01:56 PM: [sentry-webpack-plugin] Debug: Could not determine source map path for bundle: /opt/build/repo/packages/pk1/public/134cc78d375779d56b59f9cf0b87b11e235b00c3-61426bb564cb682e101b.js - Did you turn on source map generation in your bundler?
4:01:56 PM: [sentry-webpack-plugin] Debug: Could not determine source map path for bundle: /opt/build/repo/packages/pk1/public/134cc78d375779d56b59f9cf0b87b11e235b00c3-aaa39673517b266fed67.js - Did you turn on source map generation in your bundler?
...
4:01:56 PM: [sentry-webpack-plugin] Debug: Could not determine source map path for bundle: /opt/build/repo/packages/pk1/public/48251b2bc10c1b7a2503c92c2f0c3ebf831c80d9-ea244d7025199b2e8e14.js - Did you turn on source map generation in your bundler?
4:01:56 PM: [sentry-webpack-plugin] Debug: Could not determine source map path for bundle: /opt/build/repo/packages/pk1/public/731-06521c24082f25533fd7.js - Did you turn on source map generation in your bundler?
4:01:56 PM: [sentry-webpack-plugin] Debug: Could not determine source map path for bundle: ...
...
4:01:56 PM: [sentry-webpack-plugin] Debug: Could not determine source map path for bundle: /opt/build/repo/packages/pk1/public/843-25bab78a5b1bb4abb998.js - Did you turn on source map generation in your bundler?
4:01:56 PM: [sentry-webpack-plugin] Debug: Could not determine debug ID from bundle. This can happen if you did not clean your output folder before installing the Sentry plugin. File will not be source mapped: /opt/build/repo/packages/pk1/public/~partytown/partytown-sw.js
4:01:56 PM: [sentry-webpack-plugin] Debug: Could not determine debug ID from bundle. This can happen if you did not clean your output folder before installing the Sentry plugin. File will not be source mapped: /opt/build/repo/packages/pk1/public/~partytown/partytown.js
4:01:56 PM: > Found 85 files
4:01:56 PM: > Analyzing 85 sources
4:01:56 PM: > Adding source map references
4:01:57 PM: > Bundled 85 files for upload
4:01:57 PM: > Bundle ID: 3e3df91c-b25b-503e-b9f4-78f3b96102a7
4:01:58 PM: > Uploaded files to Sentry
4:01:58 PM: > File upload complete (processing pending on server)
4:01:58 PM: > Organization: project-alfa
4:01:58 PM: > Project: project1-website
4:01:58 PM: > Release: 712adf389b627eb30d20b95b94c10f0f54a503a4
4:01:58 PM: > Dist: None
4:01:58 PM: > Upload type: artifact bundle
4:01:58 PM: Source Map Upload Report
4:01:58 PM:   Scripts
4:01:58 PM:     ~/0020974e-0c4f-46e6-b1e4-7c70205b9295-36.js (sourcemap at component---src-templates-404-tsx-4e42cab8bf44d5e7f930.js.map, debug id 0020974e-0c4f-46e6-b1e4-7c70205b9295)
4:01:58 PM:     ~/008d98f3-7381-49db-be4e-2839552b3e36-54.js (sourcemap at component---src-templates-checkout-tsx-f6293a3ceb7f8d6a962b.js.map, debug id 008d98f3-7381-49db-be4e-2839552b3e36)
4:01:58 PM:     ~/054a242b-139e-4dbe-a14d-0f762824c93a-80.js (sourcemap at webpack-runtime-1fc114a7886a53728557.js.map, debug id 054a242b-139e-4dbe-a14d-0f762824c93a)
4:01:58 PM:     ~/0620bb0e-f73b-48ec-b752-c57160fb1b05-50.js (sourcemap at component---src-templates-checkout-tsx-12161fc7476d53db40e9.js.map, debug id 0620bb0e-f73b-48ec-b752-c57160fb1b05)
...
4:01:58 PM:     ~/41a4c4c9-bb80-46ad-96bb-3c7e92f555cb-77.js (sourcemap at framework-5eb66675467f9c687ef2.js.map, debug id 41a4c4c9-bb80-46ad-96bb-3c7e92f555cb)
4:01:58 PM:     ~/41a4c4c9-bb80-46ad-96bb-3c7e92f555cb-78.js (sourcemap at framework-ca6f7a72588d4949faae.js.map, debug id 41a4c4c9-bb80-46ad-96bb-3c7e92f555cb)
4:01:58 PM:     ~/41a4c4c9-bb80-46ad-96bb-3c7e92f555cb-79.js (sourcemap at framework-f88b32f0f260d805ebc1.js.map, debug id 41a4c4c9-bb80-46ad-96bb-3c7e92f555cb)
4:01:58 PM:     ~/43359a9c-4556-4363-ad0d-090789d7233e-25.js (sourcemap at app-2e7aaa04d1578fe99e14.js.map, debug id 43359a9c-4556-4363-ad0d-090789d7233e)
4:01:59 PM: [sentry-webpack-plugin] Info: Successfully uploaded source maps to Sentry
4:01:59 PM: [sentry-webpack-plugin] Debug: Waiting for dependencies on generated files to be freed before deleting...
4:02:04 PM: success Building HTML renderer - 24.590s

Steps to Reproduce

  1. Use gatsby webpack-plugin and parameter filesToDeleteAfterUpload.
  2. Source maps won't be fully uploaded.

  1. Use gatsby webpack-plugin without parameter filesToDeleteAfterUpload.
  2. Source maps will be fully uploaded.

Expected Result

Source maps fully uploaded to Sentry with errors traceable.

Actual Result

No source maps neither on Server or Sentry.

lforst commented 2 months ago

Let's leave aside filesToDeleteAfterUpload for a sec. In theory the Gatsby SDK already adds the sentryWebpackPlugin automatically. It's possible that the plugin you add yourself clashes with the one that is added automatically.

Can you try simply disabling the automatic adding of the plugin like we suggest here:

https://github.com/getsentry/sentry-javascript/blob/a69da1bab2a7a4def225d70b8ac375785887aee5/packages/gatsby/README.md#L50-L66

I would do that as a first step and then see what the logs look like!

julianCast commented 2 months ago

It's possible that the plugin you add yourself clashes with the one that is added automatically.

Very good observation, what I didn't mention (to not add too much details), is that I'm using yarn patch "@sentry/gatsby@npm:8.28.0" to modify mentioned package locally, this is the patch:

diff --git a/gatsby-node.js b/gatsby-node.js
index d60914a03061ef4599b2848abba44918cd5e1ece..ee7ff0f4e7773dd00b4c12f32049d0a42f4621e0 100644
--- a/gatsby-node.js
+++ b/gatsby-node.js
@@ -12,12 +12,14 @@ exports.onCreateWebpackConfig = ({ getConfig, actions }, options) => {
         sentryWebpackPlugin({
           sourcemaps: {
             // Only include files from the build output directory
-            assets: ['public'],
+            assets: ['./public/**'], // Workaround for Sentry not being able to find sourcemap files in the folder without glob pattern during building.
+            filesToDeleteAfterUpload: "./public/**/*.map",
             // Ignore files that aren't users' source code related
             ignore: [
               'polyfill-*', // related to polyfills
               'framework-*', // related to the frameworks (e.g. React)
               'webpack-runtime-*', // related to Webpack
+              '**/~partytown/**', // Specific to partytown
             ],
           },
           // Handle sentry-cli configuration errors when the user has not done it not to break
Lms24 commented 2 months ago

(Just leaving this reply to satisfy our internal issue response tracking tool)

Hi, This will be fixed via #13592

julianCast commented 2 months ago

Neat! One less thing for our yarn patch. Regarding the other issue (filesToDeleteAfterUpload), any idea why/how is that happening?

Use gatsby webpack-plugin and parameter filesToDeleteAfterUpload. Source maps won't be fully uploaded. ❌

Use gatsby webpack-plugin without parameter filesToDeleteAfterUpload. Source maps will be fully uploaded.

Lms24 commented 2 months ago

Did you try disabling the webpack plugin from our Gatsby package in favour of the one you added as suggested here?

julianCast commented 2 months ago

Did you try disabling the webpack plugin from our Gatsby package in favour of the one you added as suggested here?

Same exact output as before :( , I have the logs but they are the same as in the description. I changed this:

If I just remove filesToDeleteAfterUpload no source maps errors, but not source maps removed.

Let me know If I can provide anything else

lforst commented 2 months ago

Hi, I could reproduce your problem. My hunch is that gatsby is reusing the plugin for 2 build stages and the maps for stage 2 are deleted by the plugin from stage 1 or something like that.

My recommendation for now is to not use the filesToDeleteAfterUpload option and instead delete the sourcemaps by yourself after your build is done.

I will backlog this issue.

julianCast commented 2 months ago

This would ease the workflow whenever we want to use filesToDeleteAfterUpload https://github.com/getsentry/sentry-javascript/pull/13610