Deploy with deployer and composer update
Hi,
I'm tryng to deploy my project on a server with deployer (php).
When I do "composer update" locally every works fine.
But in staging or productions this error appears
[staging] Generating optimized autoload files
[staging] > Illuminate\Foundation\ComposerScripts::postAutoloadDump
[staging] > @php artisan package:discover --ansi
[staging] In RouteRegistrar.php line 107:
[staging] Attribute [singleton] does not exist.
[staging] Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
This is my composer.json
{
...
"require": {
"php": "^7.3|^8.0",
"area17/twill": "2.12.4",
"area17/twill-image": "^1.0",
"blade-ui-kit/blade-heroicons": "^1.2",
"cweagans/composer-patches": "^1.7",
"cwsdigital/twill-metadata": "^1.2.2",
"fruitcake/laravel-cors": "^2.0",
"kalnoy/nestedset": "^6.0",
"laravel/sanctum": "^2.11",
"laravel/tinker": "^2.5",
"laravelium/sitemap": "^8.0",
"mcamara/laravel-localization": "^1.7",
"sendinblue/api-v3-sdk": "8.x.x",
"ext-json": "*",
"ext-pdo": "*",
"astrotomic/laravel-translatable": "^11.5",
"cartalyst/tags": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
"doctrine/dbal": "^2.12|^3.0",
"guzzlehttp/guzzle": "^6.2|^7.0",
"imgix/imgix-php": "^3.0",
"laravel/framework": "~5.6|~5.7|~5.8|^6.0|^7.0|^8.0|^9.0",
"laravel/socialite": "^4.2|^5.0",
"laravel/ui": "^1.0|^2.0|^3.0",
"league/flysystem-aws-s3-v3": "^1.0|^2.0|^3.0",
"league/glide-laravel": "^1.0",
},
"require-dev": {
"chillerlan/php-qrcode": "~2.0|~3.0|~4.0",
"deployer/deployer": "^7.1",
"friendsofphp/php-cs-fixer": "^2.16|^3.0",
"kalnoy/nestedset": "^5.0|^6.0",
"orchestra/testbench": "~3.3|~3.4|~3.5|~3.6|~3.7|~3.8|^4.0|^5.0|^6.0|^7.0"
},...
Someone can help me please?20 Replies
Check the locked versions of the Laravel framework in the dev env and staging env, since packages are already installed.
I do not understand
this is my env file
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
IT is equals to staging env, a part of DB and APP variablesYour env isnt wrong or something. Probably your staging updated to Laravel9 and that caused an issue since that introduced a new route method
singleton
which L8 didnt have and Twill had an own implementation of it. Check https://github.com/area17/twill/issues/1961
Not the same issue, but it could be related.
Can you show us your RouteRegistrar.php
?GitHub
ā [2.x] Too few arguments to function Illuminate\Routing\Router::si...
Summary In Laravel 9 a new Route::singleton method was added. This conflicts with our usage of the singleton macro. Because of this we have released Twill 2.12.0 which renames Route::singleton to R...
I already change singleton with TwillSingleton in admin.php
?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Admin\LinkedinNewsController;
Route::group([
'prefix' => 'pages',
'middleware' => ['cache.headers'],
], function () {
Route::module('pages');
Route::twillSingleton('homepage');
Route::twillSingleton('distributor');
:::
routeRegistrat.php
you should not run composer update outside of your local environment. You should push your composer.lock file and run composer install during your deployment
Thats a custom exception in your file.
this is defaults from laravel
Yeah true, name was a bit odd so thought is was a custom.
so
i try to go back to
"area17/twill": "2.11.0",
InvalidArgumentException
Attribute [twillSingleton] does not exist.
locally i do composer update to
"area17/twill": "2.12.4",
Publishing complete.
i push everithing (composer.lock) to my repo
now i launch dep deploy
In staging it do composer install --no-dev
@Kormi
ok
nothing
`@php artisan package:discover --ansi[staging] In RouteRegistrar.php line 107: [staging] Attribute [singleton] does not exist. [staging] Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1`
if i look inside my project searching "singleton"
![No description](https://utfs.io/f/f602a9bb-d1a0-46f5-91e7-83e7e196376e-wxlyut.52.47.png)
Which Route facade are you importing in your routes file?
use Illuminate\Support\Facades\Route;
locally all works fine š