Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[AssetMapper] Fix exception if assets directory is missing in production#53701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[AssetMapper] Fix exception if assets directory is missing in production#53701
Uh oh!
There was an error while loading.Please reload this page.
Conversation
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/Resources/config/asset_mapper.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
With this PR, if someone runs the following command what would happen, exceptions would not be thrown if some directory is missing ?
|
79e49d8
to962a044
Comparerynhndrcksn commentedFeb 1, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@smnandre I've attached 2 screenshots of what happens when the If the ![]() If the ![]() So during the deployment/asset compilation process people will still be notified if the |
Perfect for me, thank you very much 👍 |
Thank you@rynhndrcksn. |
@@ -34,6 +34,7 @@ public function __construct( | |||
private readonly string $projectRootDir, | |||
private readonly array $excludedPathPatterns = [], | |||
private readonly bool $excludeDotFiles = true, | |||
private readonly bool $debug = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I set this to true by default inaa469d9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
When I did that locally while my project was set toprod
mode, it causes Symfony to crash and return a 500 error.

Is it possible thatparam('kernel.debug'),
(link to line) isn't passing infalse
when the site is inprod
mode, makingAssetMapperRepository.php
default to true, making it so the$this->debug
checks succeed while the site is inprod
mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
you can still use the prod environment in debug mode if you want locally. The prod environmentdefaults to non-debug mode, but theAPP_DEBUG
env variable still wins over this default.
During deployment some people will compile their assets with Asset Mapper then delete the root
assets/
directory. This causes Asset Mapper to throw an exception, and a common work around people mentioned in the issue is to create an emptyassets/
directory.This PR makes it so the exception is only thrown while
kernel.debug
is equal to true, letting developers know locally that there's an issue, but allowing people to safely do this in theirproduction
environments.