8000 feat: Add attachments API by timfish · Pull Request #5004 · getsentry/sentry-javascript · GitHub
[go: up one dir, main page]

Skip to content

feat: Add attachments API #5004

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 34 commits into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ed65564
Mostly there
timfish Apr 28, 2022
8db6659
Fix tests
timfish Apr 28, 2022
0dd456f
Merge remote-tracking branch 'upstream/7.x' into feat/attachments
timfish Apr 28, 2022
7388581
Fix test spy and add implementation for creating attachment item
timfish Apr 28, 2022
8d70b13
Merge remote-tracking branch 'upstream/7.x' into feat/attachments
timfish Apr 28, 2022
dcef2ab
Load attachments from paths in node
timfish Apr 28, 2022
dbd70d1
Few more minor fixes and additions
timfish Apr 28, 2022
9325e24
Merge remote-tracking branch 'upstream/7.x' into feat/attachments
timfish Apr 30, 2022
1398bfc
Parse binary envelopes in tests
timfish Apr 30, 2022
23e1f90
Merge remote-tracking branch 'upstream/7.x' into feat/attachments
timfish Apr 30, 2022
93960c6
Change `_attachmentsFromScope` return type
timfish Apr 30, 2022
23f4b29
Much improved
timfish Apr 30, 2022
fc3303c
More simplify
timfish May 1, 2022
68e077a
Final newline is optional
timfish May 1, 2022
735812e
Fix gatsby test
timfish May 1, 2022
fe7f49f
Fix node v8/v10
timfish May 1, 2022
22a8f07
Fix node session tests
timfish May 1, 2022
242292f
Don't override filename if it's supplied
timfish May 3, 2022
6d7e979
Merge remote-tracking branch 'upstream/7.x' into feat/attachments
timfish May 3, 2022
d6a8e57
Improve tests
timfish May 3, 2022
0979245
Improve types
timfish May 3, 2022
6cc6d60
Couple more minor fixes
timfish May 3, 2022
232b75b
Merge remote-tracking branch 'upstream/7.x' into feat/attachments
timfish May 3, 2022
99446c7
More type improve
timfish May 3, 2022
6c404f1
Spread headers
timfish May 4, 2022
2e85356
Remove node attachment loading special case
timfish May 5, 2022
2d25f86
Remove the need for custom jest env
timfish May 5, 2022
1731945
Fix gatsby tests
timfish May 6, 2022
250260b
Pass through hint
timfish May 12, 2022
723bfdb
Merge remote-tracking branch 'upstream/7.x' into feat/attachments
timfish May 15, 2022
21a04d8
Lint
timfish May 15, 2022
870ae81
Merge remote-tracking branch 'upstream/7.x' into feat/attachments
timfish May 15, 2022
be927c8
Remove erroneous changes
timfish May 15, 2022
c8d43eb
Review changes
timfish May 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/browser/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class BrowserClient extends BaseClient<BrowserClientOptions> {
/**
* @inheritDoc
*/
public sendEvent(event: Event): void {
public sendEvent(event: Event, hint?: EventHint): void {
// We only want to add the sentry event breadcrumb when the user has the breadcrumb integration installed and
// activated its `sentry` option.
// We also do not want to use the `Breadcrumbs` class here directly, because we do not want it to be included in
Expand Down Expand Up @@ -133,15 +133,15 @@ export class BrowserClient extends BaseClient<BrowserClientOptions> {
);
}

super.sendEvent(event);
super.sendEvent(event, hint);
}

/**
* @inheritDoc
*/
protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): PromiseLike<Event | null> {
protected _prepareEvent(event: Event, hint: EventHint, scope?: Scope): PromiseLike<Event | null> {
event.platform = event.platform || 'javascript';
return super._prepareEvent(event, scope, hint);
return super._prepareEvent(event, hint, scope);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/transports/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export function getNativeFetchImplementation(): FetchImpl {
* @param url report endpoint
* @param body report payload
*/
export function sendReport(url: string, body: string): void {
export function sendReport(url: string, body: string | Uint8Array): void {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we changing the func signature here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

serializeEnvelope now returns string | Uint8Array. In this case it will never actually be a Uint8Array because there's no attachment but both sendBeacon and fetch take body: string | Uint8Array so it seemed the best thing to do.