sfelix-martins / passport-multiauth

Add support to multi-authentication to Laravel Passport
MIT License
288 stars 51 forks source link

Class 'Symfony\\Bridge\\PsrHttpMessage\\Factory\\DiactorosFactory' not found #124

Closed iconblocks closed 4 years ago

iconblocks commented 4 years ago

Any help on fixing below error?

{
  "message": "Class 'Symfony\\Bridge\\PsrHttpMessage\\Factory\\DiactorosFactory' not found",
  "exception": "Symfony\\Component\\Debug\\Exception\\FatalThrowableError",
  "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\RoutingServiceProvider.php",
  "line": 131,
  "trace": [
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php",
      "line": 800,
      "function": "Illuminate\\Routing\\{closure}",
      "class": "Illuminate\\Routing\\RoutingServiceProvider",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php",
      "line": 682,
      "function": "build",
      "class": "Illuminate\\Container\\Container",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php",
      "line": 630,
      "function": "resolve",
      "class": "Illuminate\\Container\\Container",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php",
      "line": 768,
      "function": "make",
      "class": "Illuminate\\Container\\Container",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\RouteDependencyResolverTrait.php",
      "line": 79,
      "function": "make",
      "class": "Illuminate\\Foundation\\Application",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\RouteDependencyResolverTrait.php",
      "line": 46,
      "function": "transformDependency",
      "class": "Illuminate\\Routing\\ControllerDispatcher",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\RouteDependencyResolverTrait.php",
      "line": 27,
      "function": "resolveMethodDependencies",
      "class": "Illuminate\\Routing\\ControllerDispatcher",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerDispatcher.php",
      "line": 41,
      "function": "resolveClassMethodDependencies",
      "class": "Illuminate\\Routing\\ControllerDispatcher",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php",
      "line": 219,
      "function": "dispatch",
      "class": "Illuminate\\Routing\\ControllerDispatcher",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php",
      "line": 176,
      "function": "runController",
      "class": "Illuminate\\Routing\\Route",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
      "line": 680,
      "function": "run",
      "class": "Illuminate\\Routing\\Route",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
      "line": 130,
      "function": "Illuminate\\Routing\\{closure}",
      "class": "Illuminate\\Routing\\Router",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Middleware\\ThrottleRequests.php",
      "line": 59,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
      "line": 171,
      "function": "handle",
      "class": "Illuminate\\Routing\\Middleware\\ThrottleRequests",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\smartins\\passport-multiauth\\src\\Http\\Middleware\\AddCustomProvider.php",
      "line": 43,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
      "line": 171,
      "function": "handle",
      "class": "SMartins\\PassportMultiauth\\Http\\Middleware\\AddCustomProvider",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
      "line": 105,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
      "line": 682,
      "function": "then",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
      "line": 657,
      "function": "runRouteWithinStack",
      "class": "Illuminate\\Routing\\Router",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
      "line": 623,
      "function": "runRoute",
      "class": "Illuminate\\Routing\\Router",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
      "line": 612,
      "function": "dispatchToRoute",
      "class": "Illuminate\\Routing\\Router",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php",
      "line": 176,
      "function": "dispatch",
      "class": "Illuminate\\Routing\\Router",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
      "line": 130,
      "function": "Illuminate\\Foundation\\Http\\{closure}",
      "class": "Illuminate\\Foundation\\Http\\Kernel",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php",
      "line": 21,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
      "line": 171,
      "function": "handle",
      "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php",
      "line": 21,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
      "line": 171,
      "function": "handle",
      "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize.php",
      "line": 27,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
      "line": 171,
      "function": "handle",
      "class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode.php",
      "line": 62,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
      "line": 171,
      "function": "handle",
      "class": "Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
      "line": 105,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php",
      "line": 151,
      "function": "then",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php",
      "line": 116,
      "function": "sendRequestThroughRouter",
      "class": "Illuminate\\Foundation\\Http\\Kernel",
      "type": "->"
    },
    {
      "file": "D:\\_PROJECTS\\php7\\ustyle\\public\\index.php",
      "line": 53,
      "function": "handle",
      "class": "Illuminate\\Foundation\\Http\\Kernel",
      "type": "->"
    }
  ]
}

my composer.json as follows

"require": {
        "php": ">=7.2.0",
        "laravel/framework": "6.2",
        "laravel/passport": "8.x",
        "laravel/tinker": "~1.0",
        "smartins/passport-multiauth": "^6.0"
    },
salvationarinze commented 4 years ago

I have this exact same issue. Please help

sfelix-martins commented 4 years ago

Thanks @iconblocks @salvationarinze

Probably the #123 PR solves this problem. I'm reviewing it to fix this error ASAP.

Please, try use the PR version to test and let me know.

shafrazlk commented 4 years ago

@sfelix-martins unfortunately #123 changes didn't work for me.

michaelnguyen2021 commented 4 years ago

I have this issue as well. How do I test the #123 PR ?

bryanezavala commented 4 years ago

I have this issue too, its happens when i use the middleware multiauth. I'm using Laravel 7.1.1 and PHP 7.4

reytarovskiy commented 4 years ago

+1

Y2Nk4 commented 4 years ago

I met the same issue, and I reviewed the #123 PR. I realized it's doing the same thing as this PR https://github.com/laravel/lumen-framework/pull/1028/files, trying to replace the deprecated DiactorosFactory class by PsrHttpFactory, which is mentioned here https://github.com/symfony/psr-http-message-bridge/pull/75.

So I tried to do the same thing, and it actually works for me in Laravel 7, PHP 7.4.1, Passport 8.0. For those who tried but it didn't work, I highly recommend you guysto check if the psr-http-message-bridge is correctly installed in the project.

juhasev commented 4 years ago

I have the same issue. PHP 7.4. Laravel 6.x.latest.

"smartins/passport-multiauth": "6.x-dev"

mengdodo commented 4 years ago

Class 'Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory' not found

[2020-03-25 16:13:42] dev.ERROR: Class 'Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory' not found {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Class 'Symfony\\Bridge\\PsrHttpMessage\\Factory\\DiactorosFactory' not found at /home/vagrant/code/www.mininggame.dev/vendor/smartins/passport-multiauth/src/Facades/ServerRequest.php:17)
[stacktrace]

in my composer.json

"require": {
        "php": "^7.2",
        "ext-json": "*",
        "fideloper/proxy": "^4.0",
        "funkjedi/composer-include-files": "^1.0",
        "guzzlehttp/guzzle": "^6.4",
        "hieu-le/active": "^4.0",
        "laravel/framework": "^6.0",
        "laravel/passport": "^8.0",
        "laravel/tinker": "^1.0",
        "laravelcollective/html": "^6.1",
        "league/fractal": "^0.19.2",
        "nwidart/laravel-modules": "^6.2",
        "overtrue/laravel-lang": "~3.0",
        "predis/predis": "^1.1",
        "smartins/passport-multiauth": "^6.0",
        "spatie/laravel-permission": "^3.2"
    },
mehrdadx10 commented 4 years ago

passport v8.4.1 updated symfony/psr-http-message-bridge from ^1.0 to ^v2.0

temporary solution: use passport "v8.4.0"

composer remove smartins/passport-multiauth
composer remove laravel/passport
composer require laravel/passport:8.4.0
composer require smartins/passport-multiauth
mengdodo commented 4 years ago

passport v8.4.1 updated symfony/psr-http-message-bridge from ^1.0 to ^v2.0

temporary solution: use passport "v8.4.0"

composer remove smartins/passport-multiauth
composer remove laravel/passport
composer require laravel/passport:8.4.0
composer require smartins/passport-multiauth

Downgrading is not a good idea

kristianheljas commented 4 years ago

As #123 hasn't moved forward a few weeks, I decided to create my own PR #126.

For backward compatibility, I used the Laravel Framework implementation mentioned in the PR so additional version bump/lock is not needed.