deployer
deployer copied to clipboard
magento 2 recipe error on deploy assets
Deployer version: 7.3.1 Deployment OS: linux
namespace Deployer;
require 'recipe/magento2.php';
// Config
set('repository', 'test');
add('shared_files', []);
add('shared_dirs', []);
add('writable_dirs', []);
set('static_content_locales', 'en_US nl_NL');
// Hosts
host('live')
->set('hostname', 'xxx.xxx.xxx.xxx')
->set('branch', 'test')
->set('remote_user', 'test')
->set('deploy_path', '/var/www/test');
after('deploy:failed', 'deploy:unlock');
this is my deployer for my new project running the latest magento 2. but during the deploy in the step magento:deploy:assets i get the error
[live] error in magento2.php on line 197:
[live] run /usr/bin/php /var/www/test/releases/7/bin/magento setup:static-content:deploy --content-version=1690207325 en_US -j 1
[live] err Error happened during deploy process: Type Error occurred when creating object: Magento\Deploy\Source\SourcePool, Magento\Deploy\Source\SourcePool::__construct(): Argument #1 ($sources) must be of type array, null given, called in /var/www/test/releases/7/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121
Upvote & Fund
- We're using Polar.sh so you can upvote and help fund this issue.
- We receive the funding once the issue is completed & confirmed by you.
- Thank you in advance for helping prioritize & fund our backlog.
It fails because you're missing part of the required configuration on magento side. You have to run:
bin/magento app:config:dump scopes themes
This is going to add additional configuration to your app/etc/config.php
which is required for static content deployment to work in a pipeline.
You may want to add this to app/etc/config.php
too:
'system' => [
'default' => [
'dev' => [
'js' => [
'merge_files' => '1',
'minify_files' => '1'
],
'css' => [
'merge_files' => '1',
'minify_files' => '1'
],
'template' => [
'minify_html' => '1'
]
]
]
As referred in https://deployer.org/docs/7.x/recipe/magento2#magentodeployassets
You may also want to check this article https://www.michiel-gerritsen.com/deploying-magento-using-deployer-and-github-actions