snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

Call to undefined method Laravel\Passport\Passport::withCookieSerialization()

Open JonathanPagara opened this issue 6 years ago • 33 comments

Please confirm you have done the following before posting your bug report:

Describe the bug After the upgrade to the latest Snipe-IT version, I am getting the FatalThrowableError Call to undefined method Laravel\Passport\Passport::withCookieSerialization().

It was working before the upgrade.

Screenshots image

Server (please complete the following information):

  • Snipe-IT Version: v5.0.0
  • OS: Ubuntu Server 18.04.1
  • Web Server: Apache
  • PHP Version: 7.2.24

Error Messages (1/1) FatalThrowableError Call to undefined method Laravel\Passport\Passport::withCookieSerialization()

in AuthServiceProvider.php line 92 at AuthServiceProvider->boot() at call_user_func_array(array(object(AuthServiceProvider), 'boot'), array()) in BoundMethod.php line 29 at BoundMethod::Illuminate\Container{closure}() in BoundMethod.php line 87 at BoundMethod::callBoundMethod(object(Application), array(object(AuthServiceProvider), 'boot'), object(Closure)) in BoundMethod.php line 31 at BoundMethod::call(object(Application), array(object(AuthServiceProvider), 'boot'), array(), null) in Container.php line 549 at Container->call(array(object(AuthServiceProvider), 'boot')) in Application.php line 792 at Application->bootProvider(object(AuthServiceProvider)) in Application.php line 775 at Application->Illuminate\Foundation{closure}(object(AuthServiceProvider), 27) at array_walk(array(object(EventServiceProvider), object(LogServiceProvider), object(RoutingServiceProvider), object(AuthServiceProvider), object(CookieServiceProvider), object(DatabaseServiceProvider), object(EncryptionServiceProvider), object(FilesystemServiceProvider), object(FormRequestServiceProvider), object(FoundationServiceProvider), object(NotificationServiceProvider), object(PaginationServiceProvider), object(SessionServiceProvider), object(ViewServiceProvider), object(ServiceProvider), object(ServiceProvider), object(ServiceProvider), object(TrustedProxyServiceProvider), object(ImageServiceProvider), object(PassportServiceProvider), object(ServiceProvider), object(ServiceProvider), object(PasswordStrengthServiceProvider), object(BackupServiceProvider), object(ZiggyServiceProvider), object(DumbPasswordServiceProvider), object(AppServiceProvider), object(AuthServiceProvider), object(EventServiceProvider), object(RouteServiceProvider), object(SettingsServiceProvider), object(ValidationServiceProvider), object(MacroServiceProvider), object(LdapServiceProvider), object(SamlServiceProvider), object(MailServiceProvider), object(QueueServiceProvider), object(TranslationServiceProvider), object(ValidationServiceProvider), object(HashServiceProvider)), object(Closure)) in Application.php line 776 at Application->boot() in BootProviders.php line 17 at BootProviders->bootstrap(object(Application)) in Application.php line 213 at Application->bootstrapWith(array('Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables', 'Illuminate\Foundation\Bootstrap\LoadConfiguration', 'Illuminate\Foundation\Bootstrap\HandleExceptions', 'Illuminate\Foundation\Bootstrap\RegisterFacades', 'Illuminate\Foundation\Bootstrap\RegisterProviders', 'Illuminate\Foundation\Bootstrap\BootProviders')) in Kernel.php line 162 at Kernel->bootstrap() in Kernel.php line 146 at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116 at Kernel->handle(object(Request)) in index.php line 58

Additional context

When I try to run the php artisan config:clear or php artisan config:cache it returns this error: image

JonathanPagara avatar Oct 20 '20 12:10 JonathanPagara

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

welcome[bot] avatar Oct 20 '20 12:10 welcome[bot]

Same issue with my installation. Same error content, everything. I'm running it on a Windows Server 2016 Datacenter.

itscsquared avatar Oct 20 '20 16:10 itscsquared

I was able to mitigate this by commenting out that line from AuthServiceProvider.php, running the Handy Commands from the Common Issues instructions, then running the upgrade.php and then uncommenting out that line.

Though, I don't know what the downstream impacts of that are.

goneafk avatar Oct 20 '20 20:10 goneafk

Hm... thanks everyone for reporting this. Everything is working on our end, but I have seen this error come through a few times for our customers (not all of them, sigh), so it’s a priority to get it fixed ASAP.

snipe avatar Oct 20 '20 20:10 snipe

I’ll have a fix out within the next 24-48 hours and I’ll issue a point release. I don’t actually yet know why it’s happening, but I’ll figure it out.

snipe avatar Oct 20 '20 20:10 snipe

Can you all confirm that you’re seeing this with upgrades only, no fresh installs?

Also if you delete the contents of your vendor directory and re-run composer install, does it change anything?

snipe avatar Oct 20 '20 21:10 snipe

(Also try clearing your cookies and report back if that helps at all)

snipe avatar Oct 20 '20 21:10 snipe

@snipe I can confirm it was an upgrade, not a fresh install.

If I delete the contents of the vendor directory, does that remove those vendors inside of Snipe itself?

I didn't have a chance to clear the cookies or anything, I rolled back the change on our VM as soon as I realized there was an issue I couldn't troubleshoot right away.

itscsquared avatar Oct 20 '20 23:10 itscsquared

Can you all confirm that you’re seeing this with upgrades only, no fresh installs?

Also if you delete the contents of your vendor directory and re-run composer install, does it change anything?

Hi @snipe in my case it was an upgrade aswell.

I've tried to update composer and issue remains.

JonathanPagara avatar Oct 21 '20 08:10 JonathanPagara

@itscsquared it removes all of the vendors composer installs. Sometimes there can be cached versions of vendors, and while composer should be updating them properly, I’ve seen it happen that old files don’t get deleted. Deleting the contents of the vendors directory and then re-running composer simply removes those libraries and re-adds them.

If you can try that and then clear your cookies, that would be very informative. We haven’t run into this ourselves, but since several people are running into this, my guess is that either vendors or cookies are out of alignment.

snipe avatar Oct 21 '20 18:10 snipe

@snipe Understood. I will give this a try tomorrow and see if anything changes. I'll report back with more info.

Also, should I clear the Vendors folder before or after running the upgrade command?

Thanks for all your help.

itscsquared avatar Oct 21 '20 18:10 itscsquared

@snipe can confirm. In my case php-ldap was missing (I'm not using it). Installed, cleared vendor folder... run composer install, then php upgrade.php. All working

dragonauta avatar Oct 21 '20 19:10 dragonauta

Also, should I clear the Vendors folder before or after running the upgrade command?

It kinda doesn't matter? But I'd say before. That order doesn't really matter that much, what matters is that you clear that directory and then run composer install --no-dev to put those libraries back (hopefully without any weird cached versions).

snipe avatar Oct 21 '20 19:10 snipe

@dragonauta - awesome to hear, thanks so much! It's really, really dumb that that's the message you get when you're missing a PHP library. I don't know there's much we can do about that as it's really kind of a stack issue, but I'll see moving forward if we can maybe do a library check in that upgrade script and stop the upgrade if required libraries are missing.

snipe avatar Oct 21 '20 19:10 snipe

It's really, really dumb that that's the message you get when you're missing a PHP library.

Actually I don't mentioned but when you run php upgrade.php you can see in Step 4 the AuthServiceProvider.php line 92 error. Then in Step 5 I saw:

Problem 1 - Installation request for adldap2/adldap2 v10.2.3 -> satisfiable by adldap2/adldap2[v10.2.3]. - adldap2/adldap2 v10.2.3 requires ext-ldap * -> the requested PHP extension ldap is missing from your system.

Which led me to do steps on my previous comment and all was OK.

dragonauta avatar Oct 21 '20 19:10 dragonauta

@dragonauta perfect! I still wish there was a way we could better communicate that to users. A cookie serialization error is not remotely the problem here, and it just leads to confusion. Very glad you're all sorted though.

snipe avatar Oct 21 '20 20:10 snipe

Working for me aswell. Thanks @dragonauta .

Another thing that gave me an error was missing php-bcmath extension. So I installed php-ldap and php-bcmath, cleared vendor folder, ran composer install and then php upgrade.php.

JonathanPagara avatar Oct 21 '20 20:10 JonathanPagara

Thanks so much for your sleuthing on this, folks. I'll make sure I add this (bizarre and not-very-helpful) error message to the docs, so folks know how to handle it moving forward.

SealOfApproval

snipe avatar Oct 21 '20 20:10 snipe

Docs are updated - thanks again everyone! https://snipe-it.readme.io/docs/installation-issues#call-to-undefined-method-laravelpassportpassportwithcookieserialization

Snipe-IT Documentation
Common installation/upgrading issues and solutions

snipe avatar Oct 21 '20 20:10 snipe

When I try to follow the steps above I'm getting the following error:

C:\inetpub\wwwroot\snipe-it>composer install --no-dev PHP Warning: PHP Startup: Unable to load dynamic library 'php_curl.dll' (tried: C:\PHP\ext\php_curl.dll (%1 is not a valid Win32 application.), C:\PHP\ext\php_ php_curl.dll.dll (The specified module could not be found.)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'php_gd2.dll' (tried: C:\PHP\ext\php_gd2.dll (%1 is not a valid Win32 application.), C:\PHP\ext\php_ph p_gd2.dll.dll (The specified module could not be found.)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'php_mysqli.dll' (trie d: C:\PHP\ext\php_mysqli.dll (%1 is not a valid Win32 application.), C:\PHP\ext
php_php_mysqli.dll.dll (The specified module could not be found.)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'php_mbstring.dll' (tr ied: C:\PHP\ext\php_mbstring.dll (%1 is not a valid Win32 application.), C:\PHP
ext\php_php_mbstring.dll.dll (The specified module could not be found.)) in Unkn own on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'php_openssl.dll' (tri ed: C:\PHP\ext\php_openssl.dll (%1 is not a valid Win32 application.), C:\PHP\ex t\php_php_openssl.dll.dll (The specified module could not be found.)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'php_exif.dll' (tried: C:\PHP\ext\php_exif.dll (%1 is not a valid Win32 application.), C:\PHP\ext\php_ php_exif.dll.dll (The specified module could not be found.)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'php_fileinfo.dll' (tr ied: C:\PHP\ext\php_fileinfo.dll (%1 is not a valid Win32 application.), C:\PHP
ext\php_php_fileinfo.dll.dll (The specified module could not be found.)) in Unkn own on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'php_pdo_mysql.dll' (t ried: C:\PHP\ext\php_pdo_mysql.dll (%1 is not a valid Win32 application.), C:\PH P\ext\php_php_pdo_mysql.dll.dll (The specified module could not be found.)) in U nknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'php_ldap.dll' (tried: C:\PHP\ext\php_ldap.dll (%1 is not a valid Win32 application.), C:\PHP\ext\php_ php_ldap.dll.dll (The specified module could not be found.)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'php_bz2.dll' (tried: C:\PHP\ext\php_bz2.dll (%1 is not a valid Win32 application.), C:\PHP\ext\php_ph p_bz2.dll.dll (The specified module could not be found.)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'php_gettext.dll' (tri ed: C:\PHP\ext\php_gettext.dll (%1 is not a valid Win32 application.), C:\PHP\ex t\php_php_gettext.dll.dll (The specified module could not be found.)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'php_soap.dll' (tried: C:\PHP\ext\php_soap.dll (%1 is not a valid Win32 application.), C:\PHP\ext\php_ php_soap.dll.dll (The specified module could not be found.)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'php_xmlrpc.dll' (trie d: C:\PHP\ext\php_xmlrpc.dll (%1 is not a valid Win32 application.), C:\PHP\ext
php_php_xmlrpc.dll.dll (The specified module could not be found.)) in Unknown on line 0

Running on server 2012r2

CoventryIT avatar Oct 23 '20 13:10 CoventryIT