Giter Club home page Giter Club logo

craft-sentry's People

Contributors

brianjhanson avatar cgivord avatar jamesedmonston avatar jamesmacwhite avatar joshuabaker avatar kringkaste avatar roelvanhintum avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

craft-sentry's Issues

Load Sentry JS SDK on front end requests.

I got shot down on this request on the original project here: lukeyouell/craft-sentry#19

But I'll give it another go. A Craft 2 version of a Sentry plugin loaded both the PHP SDK and the JS client on the front end for monitoring JS based exception. This was using the Raven SDK: https://docs.sentry.io/clients/javascript/ which is now deprecated and replaced by this SDK: https://docs.sentry.io/platforms/javascript/

While you don't need this plugin to implement the JS client, for neatness and given all of the Sentry values that can be configured will be easily pulled in from either the existing Sentry config options or Craft environment variables, would you consider extending this plugin to load the JS client on the front end with a Sentry.init call that loads in DSN, settings etc?

If not I will do it in a module instead, but just wondered as it was originally possible in Craft 2.

Enabling JS errors interferes with frontend JS

Bit of a strange one this.

There are no errors reported in the console, just notifications as Sentry does its thing. However on a page where there is a Craft Commerce Stripe payment intent form, the JavaScript SDK that loads from Stripe doesn't initiate so the payment form doesn't work.

Changing reportJsErrors to false resolves the issue, so appears to be down to Sentry's JS tracking.

Installation error

Hello.

I have an installation error:

  Problem 1
    - sentry/sentry 2.2.5 requires php ^7.1 -> your PHP version (7.2.10) overridden by "config.platform.php" version (7.0) does not satisfy that requirement.
    - sentry/sentry 2.2.4 requires php ^7.1 -> your PHP version (7.2.10) overridden by "config.platform.php" version (7.0) does not satisfy that requirement.
    - sentry/sentry 2.2.3 requires php ^7.1 -> your PHP version (7.2.10) overridden by "config.platform.php" version (7.0) does not satisfy that requirement.
    - sentry/sentry 2.2.2 requires php ^7.1 -> your PHP version (7.2.10) overridden by "config.platform.php" version (7.0) does not satisfy that requirement.
    - sentry/sentry 2.2.1 requires php ^7.1 -> your PHP version (7.2.10) overridden by "config.platform.php" version (7.0) does not satisfy that requirement.
    - sentry/sentry 2.2.0 requires php ^7.1 -> your PHP version (7.2.10) overridden by "config.platform.php" version (7.0) does not satisfy that requirement.
    - sentry/sentry 2.1.3 requires php ^7.1 -> your PHP version (7.2.10) overridden by "config.platform.php" version (7.0) does not satisfy that requirement.
    - born05/craft-sentry 1.0.0 requires sentry/sdk ^2.0.4 -> satisfiable by sentry/sdk[2.0.4].
    - sentry/sdk 2.0.4 requires sentry/sentry ^2.1.3 -> satisfiable by sentry/sentry[2.1.3, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.4, 2.2.5].
    - Installation request for born05/craft-sentry ^1.0 -> satisfiable by born05/craft-sentry[1.0.0].

How I can fix it?
Thanks

User data in request body

Is there a way to prevent the body of the request being sent to Sentry for specified endpoints?
I would like to avoid sending user information to sentry when for example the registration form is not working. I know I can manipulate the data in Sentry, so it is not shown, but ideally it would not even be sent to Sentry.

Question: Usage inside another plugin

Hi, sorry for dummy question, but could you please explain how I can use your plugin inside another plugin?

eg:

<?php

namespace dev\name;

use Craft;
use yii\base\Event;
use craft\guestentries\controllers\SaveController;
use craft\guestentries\events\SaveEvent;

class Plugin extends \craft\base\Plugin
{

	public $hasCpSection = false;

	public function init()
	{
		parent::init();

		Event::on(SaveController::class, SaveController::EVENT_AFTER_SAVE_ENTRY, function(SaveEvent $e) {
				$entry = $e->entry;

				if (cond) {

					// main logic

				} else {

					// send error to sentry

				}

Thanks

NotFoundHttpException from templates

If you use the exit function within Twig like

{% exit 404 %}

the exception is captured and transmitted to Sentry even if you excluded the code (404) in the plugins config. The NotFoundHttpException exception is catched by Twig\Error\RuntimeError. This is new since Craft 4. We are running Craft 4.2.2 having this issue. I'm not sure, if this can be fixed by your plugin.

Not logging in devMode

According to the README.md and the if-statement in the init-function, the plugin will not log exceptions in devMode. May I ask why you made this choice?

I always would like to test things before updating the live website. Disabling devMode could be an option, but as there already is an config option enabled, why not configure this option from environment variables?

Eg.:

SENTRY_ENABLED=true

and

'enabled' => getenv('SENTRY_ENABLED')

The development .env-file would then disable Sentry, while the .env.production enable it when replacing .env during deployment. It feels strange checking both enabled and devMode.

sentry-sdk.php config is ignored in latest version(s)?

Seeing these errors in dev environment:

2020-01-16 11:38:35 [-][-][-][error][sentry-sdk] Failed to report exception due to missing client key (DSN)

While my config disabled sentry for dev environment:

<?php

return [
    '*' => [
        'enabled' => false,
        'excludedCodes' => ['400', '404', '429'],
    ],
    'production' => [
        'enabled' => true,
        'clientDsn' => getenv('SENTRY_DSN'),
    ],
];

Sentry URL tag values are invalid URLs

When using the Sentry SDK plugin, the URL tag value for an event is including the plain HTTP port value in the URL. This is invalid as it's a TLS connection with plain HTTP port 80.

Example:

image

A URL of https://example.com:80, will never be valid.

Doing some investigation this seems to be potentially from the SERVER_PORT in PHP. However I contacted Sentry about this and they said it likely relates to the hosting environment/reverse proxy, so it might not be an issue with this plugin either but currently all the URL values are invalid.

I even tested this on local dev which also uses a Docker setup with proxying and this had URLs with https://example.com:8080 and SERVER_PORT was 8080, so it seems like this is where the issue is, but how you can actually override it or fix it I'm not sure.

Logging console exceptions

It seems that exceptions being thrown in the console are not pushed to Sentry, is that correct? Could this be added?

Add IP address to user data if anonymous mode is not enabled

As a feature request, in addition to the current user data, adding the IP address of the request may be useful, but only when anonymous mode is not enabled.

Equally, you could pass the IP address when there is no user present e.g. Craft Solo.

"Element query executed before Craft is fully initialized" warning when using craft-sentry

Hi all. I'm getting the following warning in the logs panel of the Craft debug toolbar and I think I've narrowed it down to this plugin. When the plugin is enabled I get:

craft\elements\db\ElementQuery::prepare
Element query executed before Craft is fully initialized.

Project stack:

  • PHP 8.1.7
  • MySQL 8.0.27
  • Craft Solo 4.1.2
  • craft-sentry 2.0.0-beta.1

My config file:

<?php

return [
    '*' => [
        'enabled'        => true,
        'anonymous'      => false,
        'clientDsn'      => getenv('SENTRY_DSN'),
        'excludedCodes'  => ['400', '404', '429'],
        'release'        => getenv('SENTRY_RELEASE') ?: null,
        'reportJsErrors' => false,
        'sampleRate'     => 0,
    ],
];

Note that I've also tried 'anonymous' => true but that doesn't seem to make any difference.

Let me know if I can provide any other info. Thanks!

Remove 400/429 error codes being hidden by default

The default configuration example will automatically prevent 400, 404 and 429 error codes being reported by default.

Would it be safer to reduce this to just 404 errors, 400 and 429 might be useful or potentially mask issues. e.g. for 400 errors if there are CSRF issues, these would be masked.

Improve check for Craft Environment variable

In one of our projects, we have the problem that the CRAFT_ENVIRONMENT variable (even though correctly defined in the web/index.php file) is not correctly consumed by the plugin. This unfortunately breaks our build pipeline as well as each queue job that wants to report a Sentry error.

I therefore propose an additional check in the file Plugin.php (line 64) in order to make sure that the right Craft Environment is consumed:

'environment' => defined('CRAFT_ENVIRONMENT') ? CRAFT_ENVIRONMENT : getenv('ENVIRONMENT')

Second Sentry plugin

Hi, could you please explain why you published a second Sentry plugin which is based on the first one by Luke?

Error when used in conjunction with Link field plugin

When Sentry is enabled, I'm running across this issue: sebastian-lenz/craft-linkfield#79

It seems to stem from a change in Craft 3.3+ but I'm linking references that seem to better understand the core issue:

I'm running:

  • Craft 3.5.12.1
  • Linkfield 2.0.0-beta.10 (sebastianlenz/linkfield)
  • Craft Sentry 1.0.6

Let me know if you need any more info.
Thanks!
Dustin

Add the ability to supress specific exceptions

There are times where I'd quite like to have more granular control over which exceptions are being logged into Sentry by my application. I'm, wondering if in the configuration for this module we could have the ability to add specific error classes to an array which are ignored.

This should be easy to achieve by tapping into the error handling function and adding an extra check to see if we should log that exception:

Event::on(
    ErrorHandler::class,
    ErrorHandler::EVENT_BEFORE_HANDLE_EXCEPTION,
    function(ExceptionEvent $event) {
        $this->sentry->handleException($event->exception);
    }
);

I was sure at one point Laravel gave you that level of fine control but can't seem to find an example ๐Ÿค”

Happy to submit a PR for this if you think it could be useful.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.