Skip to content

Commit

Permalink
Remove problematic Sentry integration
Browse files Browse the repository at this point in the history
  • Loading branch information
namoscato committed Aug 6, 2022
1 parent aca1768 commit 5a0401f
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 91 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
- [Node](#node-1)
- [Browser](#browser)
- [Error event](#error-event)
- [Sentry Integration](#sentry-integration)
- [Versioning](#versioning)
- [Contributing](#contributing)

Expand Down Expand Up @@ -232,10 +231,6 @@ Error contains details field with responseBody, responseHeaders, code (only when

Upload abort throws an `FilestackError` with type `FilestackErrorType.ABORTED`

## Sentry Integration

If you're using [Sentry](https://sentry.io/welcome/) to monitor your application, Filestack will automatically report upload errors to Sentry, and tag them with helpful diagnostic information via [`@sentry/minimal`](https://github.com/getsentry/sentry-javascript/tree/master/packages/minimal).

## Versioning

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags](https://github.com/filestack/filestack-js/tags) on this repository.
Expand Down
2 changes: 0 additions & 2 deletions manual_tests/upload_new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@

// import { Client } from './../src/lib/client';
// import * as Path from 'path';
// import * as Sentry from '@sentry/node';

import { S3Uploader } from './../src/lib/api/upload/uploaders/s3';
import { getFile } from '../src/lib/api/upload';

const createFile = (size = 10 * 1024 * 1024) => Buffer.alloc(size).fill('a');
// Sentry.init({ dsn: 'DSN' });

// const fs = new Client(process.env.API_KEY);
// fs.on('upload.error', (e) => {
Expand Down
37 changes: 2 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@
"lodash.clonedeep": "^4.5.0",
"p-queue": "^4.0.0",
"spark-md5": "^3.0.0",
"ts-node": "^8.10.2",
"@sentry/minimal": "^6.2.1"
"ts-node": "^8.10.2"
},
"devDependencies": {
"@babel/core": "^7.8.4",
Expand Down
48 changes: 9 additions & 39 deletions src/lib/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/

import { EventEmitter } from 'eventemitter3';
import * as Sentry from '@sentry/minimal';
import { config, Hosts } from '../config';
import { FilestackError } from './../filestack_error';
import { metadata, MetadataOptions, remove, retrieve, RetrieveOptions, download } from './api/file';
Expand All @@ -32,9 +31,6 @@ import { StoreParams } from './filelink';

import { picker, PickerInstance, PickerOptions } from './picker';

/* istanbul ignore next */
Sentry.addBreadcrumb({ category: 'sdk', message: 'filestack-js-sdk scope' });

export interface Session {
apikey: string;
urls: Hosts;
Expand Down Expand Up @@ -70,12 +66,6 @@ export interface ClientOptions {
* Please be aware that tokens stored in localStorage are accessible by other scripts on the same domain.
*/
sessionCache?: boolean;

/**
* Enable forwarding error logs to sentry
* @default false
*/
forwardErrors?: boolean;
}

/**
Expand All @@ -99,8 +89,6 @@ export class Client extends EventEmitter {
private cloud: CloudClient;
private prefetchInstance: Prefetch;

private forwardErrors: boolean = true;

/**
* Returns filestack utils
*
Expand All @@ -114,11 +102,6 @@ export class Client extends EventEmitter {
constructor(apikey: string, private options?: ClientOptions) {
super();

/* istanbul ignore if */
if (options && options.forwardErrors) {
this.forwardErrors = options.forwardErrors;
}

if (!apikey || typeof apikey !== 'string' || apikey.length === 0) {
throw new Error('An apikey is required to initialize the Filestack client');
}
Expand Down Expand Up @@ -305,7 +288,15 @@ export class Client extends EventEmitter {
* @param headers Optional headers to send
* @param workflowIds Optional workflowIds to send
*/
storeURL(url: string, storeParams?: StoreParams, token?: any, security?: Security, uploadTags?: UploadTags, headers?: {[key: string]: string}, workflowIds?: string[]): Promise<Object> {
storeURL(
url: string,
storeParams?: StoreParams,
token?: any,
security?: Security,
uploadTags?: UploadTags,
headers?: { [key: string]: string },
workflowIds?: string[],
): Promise<Object> {
return storeURL({
session: this.session,
url,
Expand Down Expand Up @@ -460,18 +451,6 @@ export class Client extends EventEmitter {
upload.on('start', () => this.emit('upload.start'));
/* istanbul ignore next */
upload.on('error', e => {
if (this.forwardErrors) {
Sentry.withScope(scope => {
scope.setTag('filestack-apikey', this.session.apikey);
scope.setTag('filestack-version', Utils.getVersion());
scope.setExtra('filestack-options', this.options);
scope.setExtras({ uploadOptions: options, storeOptions, details: e.details });
e.message = `FS-${e.message}`;

Sentry.captureException(e);
});
}

this.emit('upload.error', e);
});

Expand Down Expand Up @@ -526,15 +505,6 @@ export class Client extends EventEmitter {
upload.on('start', () => this.emit('upload.start'));
/* istanbul ignore next */
upload.on('error', e => {
Sentry.withScope(scope => {
scope.setTag('filestack-apikey', this.session.apikey);
scope.setTag('filestack-version', Utils.getVersion());
scope.setExtra('filestack-options', this.options);
scope.setExtras(e.details);
scope.setExtras({ uploadOptions: options, storeOptions });
Sentry.captureException(e);
});

this.emit('upload.error', e);
});

Expand Down
5 changes: 0 additions & 5 deletions src/lib/picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -687,11 +687,6 @@ export interface PickerOptions {
* Sets the resolution of recorded video. One of "320x240", "640x480" or "1280x720". Default is `"640x480"`.
*/
videoResolution?: string;
/**
* Use Sentry Breadcrumbs mechanism to log information about occured errors.
* It can override global objects like console, error etc. Defaults to `true`.
*/
useSentryBreadcrumbs?: boolean;
/**
* Specify which Picker instance should respond to paste event.
* By default only hovered instance responds to event.
Expand Down
3 changes: 0 additions & 3 deletions src/schema/picker.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,6 @@ export const PickerParamsSchema = {
},
},
},
useSentryBreadcrumbs: {
type: 'boolean',
},
pasteMode: {
type: 'object',
additionalProperties: false,
Expand Down

0 comments on commit 5a0401f

Please sign in to comment.