1drop / shopware-sentry

Sentry plugin for Shopware
MIT License
20 stars 9 forks source link

Unhandled Exception in SentryClient.php:56 #11

Closed jhit closed 7 years ago

jhit commented 7 years ago

Since installing the Plugin I get this error when calling a image, that does not exist in the media manager.

`[23-Oct-2017 14:43:15 Europe/Berlin] PHP Fatal error: Uncaught Error: Call to a member function getIdentity() on null in /fingekdw/domain.tld/custom/plugins/OdSentry/Components/SentryClient.php:56 Stack trace:

0 /fingekdw/domain.tld/custom/plugins/OdSentry/OdSentry.php(89): OdSentry\Components\SentryClient->captureException(Object(Enlight_Controller_Exception))

1 /fingekdw/domain.tld/engine/Library/Enlight/Event/Handler/Default.php(91): OdSentry\OdSentry->onPreDispatchBackendError(Object(Enlight_Controller_ActionEventArgs))

2 /fingekdw/domain.tld/engine/Library/Enlight/Event/EventManager.php(214): Enlight_Event_Handler_Default->execute(Object(Enlight_Controller_ActionEventArgs))

3 /fingekdw/domain.tld/engine/Library/Enlight/Controller/Action.php(147): Enlight_Event_EventManager->notify('Enlight_Control...', Object(Enlight_Controller_ActionEventArgs))

4 /fingekdw/domain.tld/engine/Library/Enlight/Controller/Dispatcher/Default.php(523): Enlight_Controller_Action->dispatch('errorAction')

5 /fingekdw/domain.tld/engine/Library/Enlight/Controller/Front.php(223): in /fingekdw/domain.tld/custom/plugins/OdSentry/Components/SentryClient.php on line 56

[23-Oct-2017 14:43:15 Europe/Berlin] PHP Fatal error: Uncaught Error: Call to a member function getIdentity() on null in /fingekdw/domain.tld/custom/plugins/OdSentry/Components/SentryClient.php:56 Stack trace:

0 /fingekdw/domain.tld/custom/plugins/OdSentry/vendor/sentry/sentry/lib/Raven/ErrorHandler.php(78): OdSentry\Components\SentryClient->captureException(Object(ErrorException), NULL, NULL, NULL)

1 /fingekdw/domain.tld/custom/plugins/OdSentry/vendor/sentry/sentry/lib/Raven/ErrorHandler.php(133): Raven_ErrorHandler->handleException(Object(ErrorException), true)

2 [internal function]: Raven_ErrorHandler->handleFatalError()

3 {main}

thrown in /fingekdw/domain.tld/custom/plugins/OdSentry/Components/SentryClient.php on line 56 [23-Oct-2017 14:47:53 Europe/Berlin] PHP Fatal error: Uncaught Error: Call to a member function getIdentity() on null in /fingekdw/domain.tld/custom/plugins/OdSentry/Components/SentryClient.php:56 Stack trace:

0 /fingekdw/domain.tld/custom/plugins/OdSentry/OdSentry.php(89): OdSentry\Components\SentryClient->captureException(Object(Enlight_Controller_Exception))

1 /fingekdw/domain.tld/engine/Library/Enlight/Event/Handler/Default.php(91): OdSentry\OdSentry->onPreDispatchBackendError(Object(Enlight_Controller_ActionEventArgs))

2 /fingekdw/domain.tld/engine/Library/Enlight/Event/EventManager.php(214): Enlight_Event_Handler_Default->execute(Object(Enlight_Controller_ActionEventArgs))

3 /fingekdw/domain.tld/engine/Library/Enlight/Controller/Action.php(147): Enlight_Event_EventManager->notify('Enlight_Control...', Object(Enlight_Controller_ActionEventArgs))

4 /fingekdw/domain.tld/engine/Library/Enlight/Controller/Dispatcher/Default.php(523): Enlight_Controller_Action->dispatch('errorAction')

5 /fingekdw/domain.tld/engine/Library/Enlight/Controller/Front.php(223): in /fingekdw/domain.tld/custom/plugins/OdSentry/Components/SentryClient.php on line 56

[23-Oct-2017 14:47:53 Europe/Berlin] PHP Fatal error: Uncaught Error: Call to a member function getIdentity() on null in /fingekdw/domain.tld/custom/plugins/OdSentry/Components/SentryClient.php:56 Stack trace:

0 /fingekdw/domain.tld/custom/plugins/OdSentry/vendor/sentry/sentry/lib/Raven/ErrorHandler.php(78): OdSentry\Components\SentryClient->captureException(Object(ErrorException), NULL, NULL, NULL)

1 /fingekdw/domain.tld/custom/plugins/OdSentry/vendor/sentry/sentry/lib/Raven/ErrorHandler.php(133): Raven_ErrorHandler->handleException(Object(ErrorException), true)

2 [internal function]: Raven_ErrorHandler->handleFatalError()

3 {main}

thrown in /fingekdw/domain.tld/custom/plugins/OdSentry/Components/SentryClient.php on line 56 [23-Oct-2017 14:48:00 Europe/Berlin] PHP Fatal error: Uncaught Error: Call to a member function getIdentity() on null in /fingekdw/domain.tld/custom/plugins/OdSentry/Components/SentryClient.php:56 Stack trace:

0 /fingekdw/domain.tld/custom/plugins/OdSentry/OdSentry.php(89): OdSentry\Components\SentryClient->captureException(Object(Enlight_Controller_Exception))

1 /fingekdw/domain.tld/engine/Library/Enlight/Event/Handler/Default.php(91): OdSentry\OdSentry->onPreDispatchBackendError(Object(Enlight_Controller_ActionEventArgs))

2 /fingekdw/domain.tld/engine/Library/Enlight/Event/EventManager.php(214): Enlight_Event_Handler_Default->execute(Object(Enlight_Controller_ActionEventArgs))

3 /fingekdw/domain.tld/engine/Library/Enlight/Controller/Action.php(147): Enlight_Event_EventManager->notify('Enlight_Control...', Object(Enlight_Controller_ActionEventArgs))

4 /fingekdw/domain.tld/engine/Library/Enlight/Controller/Dispatcher/Default.php(523): Enlight_Controller_Action->dispatch('errorAction')

5 /fingekdw/domain.tld/engine/Library/Enlight/Controller/Front.php(223): in /fingekdw/domain.tld/custom/plugins/OdSentry/Components/SentryClient.php on line 56

[23-Oct-2017 14:48:00 Europe/Berlin] PHP Fatal error: Uncaught Error: Call to a member function getIdentity() on null in /fingekdw/domain.tld/custom/plugins/OdSentry/Components/SentryClient.php:56 Stack trace:

0 /fingekdw/domain.tld/custom/plugins/OdSentry/vendor/sentry/sentry/lib/Raven/ErrorHandler.php(78): OdSentry\Components\SentryClient->captureException(Object(ErrorException), NULL, NULL, NULL)

1 /fingekdw/domain.tld/custom/plugins/OdSentry/vendor/sentry/sentry/lib/Raven/ErrorHandler.php(133): Raven_ErrorHandler->handleException(Object(ErrorException), true)

2 [internal function]: Raven_ErrorHandler->handleFatalError()

3 {main}

thrown in /fingekdw/domain.tld/custom/plugins/OdSentry/Components/SentryClient.php on line 56 `

htuscher commented 7 years ago

Hmm looks like if the grabbing of the error context results in an error itself the errorhandler catches that exception too (which is pretty useless).

@shyim What do you think, should we suppress the error by doing

$auth = @Shopware()->Plugins()->Backend()->Auth()->checkAuth();

To suppress potential errors

shyim commented 7 years ago

I would just check that Shopware()->Plugins()->Backend()->Auth() is not null

shyim commented 7 years ago

@jhit Are you on the latest version? https://github.com/1drop/shopware-sentry/blob/master/Components/SentryClient.php#L56 is executing checkAuth, but in your error message its executing getIdentity

We also checked that auth is not null 🙄

jhit commented 7 years ago

Updated the plugin today and the error does not occur any longer. The URL I was calling was like /backend/media/image/logo-180x180.png Thanks for fixing.