Skip to content

Commit

Permalink
fix: disable native if DSN is not provided (#584)
Browse files Browse the repository at this point in the history
  • Loading branch information
Floppy012 authored Mar 18, 2024
1 parent c6eb566 commit f2aaf6f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Fixes

- Native integration would not properly disable when no DSN was provided ([#584](https://github.com/getsentry/sentry-capacitor/pull/584))

## 0.16.0

### Features
Expand Down
2 changes: 2 additions & 0 deletions src/wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ export const NATIVE = {
logger.warn(
'Warning: No DSN was provided. The Sentry SDK will be disabled. Native SDK will also not be initalized.',
);

this.enableNative = false;
return false;
}

Expand Down
8 changes: 8 additions & 0 deletions test/wrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ describe('Tests Native Wrapper', () => {
'Note: Native Sentry SDK is disabled.',
);
});

test('sets enableNative: false when dsn is undefined', async () => {
await NATIVE.initNativeSdk({
dsn: undefined,
});

expect(NATIVE.enableNative).toBe(false);
});
});

describe('sendEnvelope', () => {
Expand Down

0 comments on commit f2aaf6f

Please sign in to comment.