Skip to content

Promise in transport appears to invoke twice #2506

Description

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

5.14.2

Description

I'm working on setting up Sentry in a React application and extending the FetchTransport to add a metric on the response of the request sentry.io. Debugging through the application shows my promise being invoked twice for each sendEvent call of the transport. A simplified version of my transport that still displays this is as follows:

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

export class WrappedFetchTransport extends Sentry.Transports.FetchTransport {

    public sendEvent(event: Sentry.Event): PromiseLike<Sentry.Response> {
        const promise = super.sendEvent(event);
        promise.then(
            (resp: any) => {
                console.log(resp);
            },
            (reason: any) => {
                console.log("error");
            }
        );

        return promise;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions