I have a Laravel application using Passport to provide API authentication. The application is deployed using git with a hook after receiving. Part of the post-receive script is the installation of the composer. Since I turned on Passport, whenever I deploy my application, the API breaks on the routes that are behind the authentication shutter, and the stack trace is lower.
When I go to the application server and run the same composer install command as in my post-receive method, then everything works fine.
I do not see error messages from git when the deployment occurs, and it seems that I get the same output from composer install when the deployment occurs, and when I run the command manually.
Here the output of the composer install command is expanded:
remote: Loading composer repositories with package information remote: Installing dependencies (including require-dev) from lock file remote: Nothing to install or update remote: Generating autoload files remote: > php artisan clear-compiled remote: The compiled class file has been removed. remote: > php artisan optimize remote: Generating optimized class loader remote: Compiling common classes
And this is what I see when I run the command manually:
Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Nothing to install or update Generating autoload files > php artisan clear-compiled The compiled class file has been removed. > php artisan optimize Generating optimized class loader Compiling common classes
What's going on here? Deployment seems to install an older version of some Passport component, which is then fixed after running composer install manually, but I donβt understand why this will happen, and especially why it will happen every time I deploy a new update, even if there are no changes to composer.json or composer.lock.
Here's the stack trace mentioned above:
[2017-01-04 20:36:37] production.ERROR: exception 'BadMethodCallException' with message 'Call to undefined method Illuminate\Database\Query\Builder::withAccessToken()' in /home/portalvarius/app/production/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2450 Stack trace:
githooks laravel composer-php
ralbatross
source share