Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[AssetMapper] importmap:install silently fail but say everything is ok on prod #54719

Closed
@zorn-v

Description

@zorn-v

Symfony version(s) affected

6.4.6

Description

If you have no permissions to write to assets directrory you'll just get a php warning in prod enviroment (as warnings does not converts to exceptions there).
It is not right to say "all right" when it is not I think. And return exit code 0. bash scripts with set -e continue executing with not installed assets in CI (for example). Good that assets:compile throw exeption like "you did not run importmap:install", but problem was in another place.

21:14:28 WARNING   [php] Warning: file_put_contents(/var/www/html/assets/vendor/installed.php): Failed to open stream: No such file or directory ["exception" => ErrorException { …}]

                                                                                                                        
 [OK] Downloaded 1 package into assets/vendor.                                                                          
                                                                                                                        

How to reproduce

./bin/console imp:req bootstrap
rm -rf assets/vendor
echo 'APP_ENV=prod' >> .env.local
chmod 555 assets
./bin/console imp:inst

Possible Solution

Check that downloded package exists and throw exception otherwise.

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions