magento2-sentry icon indicating copy to clipboard operation
magento2-sentry copied to clipboard

I can't login admin panel

Open JKair opened this issue 4 years ago • 10 comments

Do you want to request a feature or report a bug? bug

Bug: What is the current behavior? When I enable this module,the admin panel will sign out soon after sign in.But the website front is normal. Bug: What is the expected behavior? sign in normal. Bug: What is the proposed solution?

What is the version of Magento and of Sentry extension you are using? Always use the latest version of the extension one before opening a bug issue. Magento version:2.4.2 sentry version:2.6

JKair avatar Aug 28 '21 06:08 JKair

no error report in excetion.log

JKair avatar Aug 28 '21 06:08 JKair

Hi, that is quite odd behavior we haven't experienced before. Do you have the right configuration set in your env.php? Is there maybe anything you see that might cause it in the system.log? Or maybe something in your network tab?

I'm guessing there must be some error happening causing this logout.

I've checked on a production server running 2.4.2-p1 and it has no problems keeping me logged in in the backend. I do suggest upgrading to 2.4.2-p2+ because of the security updates but i don't expect it to cause or fix this behavior.

indykoning avatar Aug 30 '21 13:08 indykoning

I have the same problem: i can log in but after the first click in the backend menu i get logged out. But the frontend works fine. In the Magento debug.log i see:

[2021-09-07 11:44:29] .DEBUG: Request validation failed for action "Magento\Backend\Controller\Adminhtml\Index\Index\Interceptor" {"exception":"[object] (Magento\\Framework\\App\\Request\\InvalidRequestException(code: 0): Invalid request received at /var/www/online-shop2/public/vendor/magento/module-backend/App/Request/BackendValidator.php:176)"} []
[2021-09-07 11:44:29] .DEBUG: Source class "\Phalcon\Http\Message\Stream" for "Phalcon\Http\Message\StreamFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Stream\" for \"Phalcon\\Http\\Message\\StreamFactory\" generation does not exist. at /var/www/online-shop2/public/vendor/magento/framework/Code/Generator.php:222)"} []
[2021-09-07 11:44:29] .DEBUG: Source class "\Phalcon\Http\Message\Uri" for "Phalcon\Http\Message\UriFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Uri\" for \"Phalcon\\Http\\Message\\UriFactory\" generation does not exist. at /var/www/online-shop2/public/vendor/magento/framework/Code/Generator.php:222)"} []
[2021-09-07 11:44:29] .DEBUG: Source class "\Phalcon\Http\Message\Response" for "Phalcon\Http\Message\ResponseFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Response\" for \"Phalcon\\Http\\Message\\ResponseFactory\" generation does not exist. at /var/www/online-shop2/public/vendor/magento/framework/Code/Generator.php:222)"} []
[2021-09-07 11:44:29] .DEBUG: Source class "\Phalcon\Http\Message\Request" for "Phalcon\Http\Message\RequestFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Request\" for \"Phalcon\\Http\\Message\\RequestFactory\" generation does not exist. at /var/www/online-shop2/public/vendor/magento/framework/Code/Generator.php:222)"} []

Phalcon is just found in vendor/php-http/discovery:

$ grep -r Phalcon 
vendor/php-http/discovery/src/Strategy/CommonPsr17ClassesStrategy.php:            'Phalcon\Http\Message\RequestFactory',

As soon as i remove the "sentry" configuration from app/etc/env.php Phalcon doesn't appear in the debug log anymore.

I use Magento 2.3.5-p2 justbetter/magento2-sentry: 2.6.0 Dependencies: sentry/sdk: 3.1.0 sentry/sentry: 3.3.2 symfony/http-client: v5.3.7 monolog/monolog: 1.26.1 php-http/discovery: 1.14.0

dzschille avatar Sep 07 '21 12:09 dzschille

@dzschille oh,guys,thanks for your info,I've been so busy lately that haven't time to give more info to @indykoning.

JKair avatar Sep 09 '21 10:09 JKair

I am experiencing the same problem in the logs - magento 2.4.4 and php8.1:

[2022-06-13T16:31:04.813915+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Response" for "Phalcon\Http\Message\ResponseFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Response\" for \"Phalcon\\Http\\Message\\ResponseFactory\" generation does not exist. at vendor/magento/framework/Code/Generator.php:223)"} []
[2022-06-13T16:31:04.839274+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Response" for "Phalcon\Http\Message\ResponseFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Response\" for \"Phalcon\\Http\\Message\\ResponseFactory\" generation does not exist. at vendor/magento/framework/Code/Generator.php:223)"} []
[2022-06-13T16:31:04.864525+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Stream" for "Phalcon\Http\Message\StreamFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Stream\" for \"Phalcon\\Http\\Message\\StreamFactory\" generation does not exist. at vendor/magento/framework/Code/Generator.php:223)"} []
[2022-06-13T16:31:04.884219+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Stream" for "Phalcon\Http\Message\StreamFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Stream\" for \"Phalcon\\Http\\Message\\StreamFactory\" generation does not exist. at vendor/magento/framework/Code/Generator.php:223)"} []
[2022-06-13T16:31:04.892928+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Request" for "Phalcon\Http\Message\RequestFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Request\" for \"Phalcon\\Http\\Message\\RequestFactory\" generation does not exist. at vendor/magento/framework/Code/Generator.php:223)"} []
[2022-06-13T16:31:04.918881+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Request" for "Phalcon\Http\Message\RequestFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Request\" for \"Phalcon\\Http\\Message\\RequestFactory\" generation does not exist. at vendor/magento/framework/Code/Generator.php:223)"} []
[2022-06-13T16:31:04.952301+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Uri" for "Phalcon\Http\Message\UriFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Uri\" for \"Phalcon\\Http\\Message\\UriFactory\" generation does not exist. at vendor/magento/framework/Code/Generator.php:223)"} []
[2022-06-13T16:31:04.971579+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Uri" for "Phalcon\Http\Message\UriFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Uri\" for \"Phalcon\\Http\\Message\\UriFactory\" generation does not exist. at vendor/magento/framework/Code/Generator.php:223)"} []
[2022-06-13T16:31:05.018918+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Response" for "Phalcon\Http\Message\ResponseFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Response\" for \"Phalcon\\Http\\Message\\ResponseFactory\" generation does not exist. at vendor/magento/framework/Code/Generator.php:223)"} []
[2022-06-13T16:31:05.034931+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Response" for "Phalcon\Http\Message\ResponseFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Response\" for \"Phalcon\\Http\\Message\\ResponseFactory\" generation does not exist. at vendor/magento/framework/Code/Generator.php:223)"} []
[2022-06-13T16:31:05.075022+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Request" for "Phalcon\Http\Message\RequestFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Request\" for \"Phalcon\\Http\\Message\\RequestFactory\" generation does not exist. at vendor/magento/framework/Code/Generator.php:223)"} []
[2022-06-13T16:31:05.089302+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Request" for "Phalcon\Http\Message\RequestFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Request\" for \"Phalcon\\Http\\Message\\RequestFactory\" generation does not exist. at vendor/magento/framework/Code/Generator.php:223)"} []

when i remove the sentry config from the .env then the logs disappear...

simonmaass avatar Jun 13 '22 16:06 simonmaass

We have also updated to Magento 2.4.4 and have still the same error:

[2022-08-03T11:47:54.914531+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Stream" for "Phalcon\Http\Message\StreamFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Stream\" for \"Phalcon\\Http\\Message\\StreamFactory\" generation does not exist. at /var/www/public/vendor/magento/framework/Code/Generator.php:223)"} []
[2022-08-03T11:47:54.915220+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Stream" for "Phalcon\Http\Message\StreamFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Stream\" for \"Phalcon\\Http\\Message\\StreamFactory\" generation does not exist. at /var/www/public/vendor/magento/framework/Code/Generator.php:223)"} []
[2022-08-03T11:47:54.915575+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Stream" for "Phalcon\Http\Message\StreamFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Stream\" for \"Phalcon\\Http\\Message\\StreamFactory\" generation does not exist. at /var/www/public/vendor/magento/framework/Code/Generator.php:223)"} []
[2022-08-03T11:47:54.916622+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Uri" for "Phalcon\Http\Message\UriFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Uri\" for \"Phalcon\\Http\\Message\\UriFactory\" generation does not exist. at /var/www/public/vendor/magento/framework/Code/Generator.php:223)"} []
[2022-08-03T11:47:54.917997+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Uri" for "Phalcon\Http\Message\UriFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Uri\" for \"Phalcon\\Http\\Message\\UriFactory\" generation does not exist. at /var/www/public/vendor/magento/framework/Code/Generator.php:223)"} []
[2022-08-03T11:47:54.918164+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Uri" for "Phalcon\Http\Message\UriFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Uri\" for \"Phalcon\\Http\\Message\\UriFactory\" generation does not exist. at /var/www/public/vendor/magento/framework/Code/Generator.php:223)"} []
[2022-08-03T11:47:54.918602+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Response" for "Phalcon\Http\Message\ResponseFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Response\" for \"Phalcon\\Http\\Message\\ResponseFactory\" generation does not exist. at /var/www/public/vendor/magento/framework/Code/Generator.php:223)"} []
[2022-08-03T11:47:54.920163+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Response" for "Phalcon\Http\Message\ResponseFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Response\" for \"Phalcon\\Http\\Message\\ResponseFactory\" generation does not exist. at /var/www/public/vendor/magento/framework/Code/Generator.php:223)"} []
[2022-08-03T11:47:54.920459+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Request" for "Phalcon\Http\Message\RequestFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Request\" for \"Phalcon\\Http\\Message\\RequestFactory\" generation does not exist. at /var/www/public/vendor/magento/framework/Code/Generator.php:223)"} []
[2022-08-03T11:47:54.920429+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Response" for "Phalcon\Http\Message\ResponseFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Response\" for \"Phalcon\\Http\\Message\\ResponseFactory\" generation does not exist. at /var/www/public/vendor/magento/framework/Code/Generator.php:223)"} []
[2022-08-03T11:47:54.922063+00:00] .DEBUG: Source class "\Phalcon\Http\Message\Request" for "Phalcon\Http\Message\RequestFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\Phalcon\\Http\\Message\\Request\" for \"Phalcon\\Http\\Message\\RequestFactory\" generation does not exist. at /var/www/public/vendor/magento/framework/Code/Generator.php:223)"} []

When i remove the sentry config from app/etc/env.php then the logs disappears.

dzschille avatar Aug 03 '22 11:08 dzschille

For now i just created this composer patch...

--- a/src/Strategy/CommonPsr17ClassesStrategy.php
+++ b/src/Strategy/CommonPsr17ClassesStrategy.php
@@ -21,7 +21,6 @@
      */
     private static $classes = [
         RequestFactoryInterface::class => [
-            'Phalcon\Http\Message\RequestFactory',
             'Nyholm\Psr7\Factory\Psr17Factory',
             'Zend\Diactoros\RequestFactory',
             'GuzzleHttp\Psr7\HttpFactory',
@@ -32,7 +31,6 @@
             'Slim\Psr7\Factory\RequestFactory',
         ],
         ResponseFactoryInterface::class => [
-            'Phalcon\Http\Message\ResponseFactory',
             'Nyholm\Psr7\Factory\Psr17Factory',
             'Zend\Diactoros\ResponseFactory',
             'GuzzleHttp\Psr7\HttpFactory',
@@ -43,7 +41,6 @@
             'Slim\Psr7\Factory\ResponseFactory',
         ],
         ServerRequestFactoryInterface::class => [
-            'Phalcon\Http\Message\ServerRequestFactory',
             'Nyholm\Psr7\Factory\Psr17Factory',
             'Zend\Diactoros\ServerRequestFactory',
             'GuzzleHttp\Psr7\HttpFactory',
@@ -54,7 +51,6 @@
             'Slim\Psr7\Factory\ServerRequestFactory',
         ],
         StreamFactoryInterface::class => [
-            'Phalcon\Http\Message\StreamFactory',
             'Nyholm\Psr7\Factory\Psr17Factory',
             'Zend\Diactoros\StreamFactory',
             'GuzzleHttp\Psr7\HttpFactory',
@@ -65,7 +61,6 @@
             'Slim\Psr7\Factory\StreamFactory',
         ],
         UploadedFileFactoryInterface::class => [
-            'Phalcon\Http\Message\UploadedFileFactory',
             'Nyholm\Psr7\Factory\Psr17Factory',
             'Zend\Diactoros\UploadedFileFactory',
             'GuzzleHttp\Psr7\HttpFactory',
@@ -76,7 +71,6 @@
             'Slim\Psr7\Factory\UploadedFileFactory',
         ],
         UriFactoryInterface::class => [
-            'Phalcon\Http\Message\UriFactory',
             'Nyholm\Psr7\Factory\Psr17Factory',
             'Zend\Diactoros\UriFactory',
             'GuzzleHttp\Psr7\HttpFactory',

simonmaass avatar Aug 03 '22 11:08 simonmaass

I think this may have to do with Sentry's dependency on php-http/discovery which may cause issues.

I know the Magento integration does not need any of these classes itself. What kind of environment is this being run on? On a server with production settings no debug.log should get created and on a test/local environment no class generation should occur...

I'm afraid i can't reproduce these debug logs on either environment

indykoning avatar Oct 11 '22 15:10 indykoning