Skip to content

Commit

Permalink
fix: Use event_id from hint given by top-level hub calls (#2396)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilogorek committed Jan 29, 2020
1 parent bd4abef commit 6cc62f9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/core/src/baseclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
logger.error(reason);
this._processing = false;
});

return eventId;
}

Expand Down Expand Up @@ -284,7 +285,7 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
}

if (prepared.event_id === undefined) {
prepared.event_id = uuid4();
prepared.event_id = hint && hint.event_id ? hint.event_id : uuid4();
}

this._addIntegrations(prepared.sdk);
Expand Down
11 changes: 11 additions & 0 deletions packages/core/test/lib/base.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,17 @@ describe('BaseClient', () => {
});
});

test('adds event_id from hint if available', () => {
expect.assertions(1);
const client = new TestClient({ dsn: PUBLIC_DSN });
const scope = new Scope();
client.captureEvent({ message: 'message' }, { event_id: 'wat' }, scope);
expect(TestBackend.instance!.event!).toEqual({
event_id: 'wat',
message: 'message',
});
});

test('adds the configured environment', () => {
expect.assertions(1);
const client = new TestClient({
Expand Down

0 comments on commit 6cc62f9

Please sign in to comment.