You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide a link to the affected event from your Sentry account
Package + Version
@sentry/browser
@sentry/node
raven-js
raven-node(raven for node)
other:
Version:
6.7.2
Description
Trying to limit parallel event request sending by limiting buffer size in custom transport class to 2 and checking buffer is empty, get true accidentally when doing this.close(50).then(isClosed /* can be true but it is a lie */ => super.sendEvent(event)), but call to sendEvent could return rejected SyncPromise with SentyError 'Not adding Promise due to buffer limit reached.' but event was sent to server even error was thrown.
code to reproduce behaviour:
import*asSentryfrom'@sentry/browser';import{PromiseBuffer}from'@sentry/utils/dist/promisebuffer';import{SyncPromise}from'@sentry/utils/dist/syncpromise';import{CaptureConsole}from'@sentry/integrations';exportclassSentryBuggedTransportextendsSentry.Transports.FetchTransport{staticbufferLimit=2;readonly_buffer=newPromiseBuffer<Sentry.Response>(SentryBuggedTransport.bufferLimit);sendEvent(event: Sentry.Event): PromiseLike<Sentry.Response>{constawaiter2=(): PromiseLike<Sentry.Response>=>{returnthis.close(50).then((isReady)=>{if(isReady){returnsuper.sendEvent(event).then((r)=>SyncPromise.resolve(r),(e: Error)=>{this.devTool(`event failed: ${e.message}`);returnSyncPromise.reject(e);},);}else{this.devTool('THIS IS WHAT WE WANT, NOT EXCEPTION');returnawaiter2();}},(_bufferRejection)=>{console.error('Buffer poll failed. Report to support team!');returnSyncPromise.reject(_bufferRejection);},);};returnawaiter2();}// TODO: separate logger;privatedevTool(log: unknown){IS_DEV ?
// eslint-disable-next-line no-consoleconsole.debug(`[${newDate().toISOString()}]`,' SentryQueueTransport ::> ',log,) :
null;}}try{Sentry.init({dsn: `${(SENTRY_DSN||(window.env||{}).SENTRY_DSN)asstring}`,defaultIntegrations: false,maxValueLength: 2000,integrations: [newSentry.Integrations.GlobalHandlers({onerror: true,onunhandledrejection: true,}),newSentry.Integrations.UserAgent(),newSentry.Integrations.Breadcrumbs({console: false}),newCaptureConsole({levels: ['warn','error','critical','fatal']}),],transport: SentryBuggedTransport,});constappVersion=packageVersions().host.version;Sentry.setExtra('appVersion',appVersion);Promise.all(Array(90).fill(()=>Sentry.captureException('OOOPS!')).map(x=>x()));/// <<<<==== here magic happen;}catch(e){// eslint-disable-next-line no-consoleconsole.error('An error happened during initialization of Sentry',e);}
Fact result: Only certain requests blocks by buffer, most requests sent immidiately regardless buffer limit.
complete verbose log in attach sentry.log sentry.log
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Package + Version
@sentry/browser
@sentry/node
raven-js
raven-node
(raven for node)Version:
Description
Trying to limit parallel event request sending by limiting buffer size in custom transport class to 2 and checking buffer is empty, get
true
accidentally when doingthis.close(50).then(isClosed /* can be true but it is a lie */ => super.sendEvent(event))
, but call to sendEvent could return rejected SyncPromise withSentyError 'Not adding Promise due to buffer limit reached.'
but event was sent to server even error was thrown.code to reproduce behaviour:
Fact result: Only certain requests blocks by buffer, most requests sent immidiately regardless buffer limit.
complete verbose log in attach sentry.log
sentry.log
The text was updated successfully, but these errors were encountered: