Skip to content

Commit 87c8e14

Browse files
fix(core): Stop awaiting build start telemetry to avoid breaking module federation builds (#818)
* fix(core): Stop awaiting build start telemetry to avoid breaking module federation builds Prior to this fix, we would create a span when the build starts and await flushing it before proceeding with the build. This breaks when using module federation builds as outlined in #816. This fix removes the blocking await and optimistically fires off the span. This **should** be fine as we definitely care more about not breaking user builds than telemetry arriving. It could lead to us potentially missing this span sometimes when builds run very fast and finish before the span flushes out, however given that the build process usually takes longer (especially when sourcemaps and uploading sourcemaps is involved) it should be fine most of the time. Closes: #816 * Update packages/bundler-plugin-core/src/index.ts Co-authored-by: Jan Peer Stöcklmair <jan.oster94@gmail.com> --------- Co-authored-by: Jan Peer Stöcklmair <jan.oster94@gmail.com>
1 parent fb36641 commit 87c8e14

File tree

1 file changed

+9
-2
lines changed
  • packages/bundler-plugin-core/src

1 file changed

+9
-2
lines changed

packages/bundler-plugin-core/src/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,15 @@ export function sentryUnpluginFactory({
7777
// Add plugin to emit a telemetry signal when the build starts
7878
plugins.push({
7979
name: "sentry-telemetry-plugin",
80-
async buildStart() {
81-
await sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal();
80+
buildStart() {
81+
// Technically, for very fast builds we might miss the telemetry signal
82+
// but it's okay because telemetry is not critical for us.
83+
// We cannot await the flush here because it would block the build start
84+
// which in turn would break module federation builds, see
85+
// https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/816
86+
void sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {
87+
// Nothing for the users to do here. If telemetry fails it's acceptable.
88+
});
8289
},
8390
});
8491

0 commit comments

Comments
 (0)