Skip to content
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

Add support for Javascript Sentry Support #3

Merged
merged 18 commits into from
Feb 27, 2023
Merged

Add support for Javascript Sentry Support #3

merged 18 commits into from
Feb 27, 2023

Conversation

jaxwilko
Copy link
Member

This PR adds support for a javascript specific sentry monitor.

Add: SENTRY_JAVASCRIPT_DSN="..." to your .env and the plugin will dynamically inject the sdk and it's configs into backend and frontend pages.

Plugin.php Outdated Show resolved Hide resolved
Plugin.php Outdated Show resolved Hide resolved
Plugin.php Outdated Show resolved Hide resolved
Plugin.php Outdated
@@ -46,6 +47,10 @@ public function boot()
app('sentry')->captureException($exception);
}
});

if ($jsDsn = env('SENTRY_JAVASCRIPT_DSN')) {
Copy link
Member

Choose a reason for hiding this comment

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

Use the config instead here, sentry.dsn_js, set in winter.sentry.packages.sentry/sentry-laravel.config.dsn_js. That way it can be dynamically configured on a per request basis, for instance if someone wanted to inject a different DSN in the backend vs the frontend contexts.

Copy link
Member Author

Choose a reason for hiding this comment

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

I did try this before, but ran into this issue:
image

Copy link
Member

Choose a reason for hiding this comment

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

@jaxwilko that's because you're using js_dsn, it's defined as dsn_js

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah but it doesn't matter what it's called, if you add something that is missing from the predefined list of options, it throws the exception, see:
image
image
image

assets/js/src/sentry.js Outdated Show resolved Hide resolved
winter.mix.js Outdated Show resolved Hide resolved
winter.mix.js Outdated Show resolved Hide resolved
config/config.php Outdated Show resolved Hide resolved
@LukeTowers LukeTowers changed the title [WIP] Javascript Sentry Support Add support for Javascript Sentry Support Feb 27, 2023
@LukeTowers LukeTowers merged commit 9261400 into main Feb 27, 2023
@LukeTowers LukeTowers deleted the wip/js-sentry branch February 27, 2023 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants