Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Conversation

rynhndrcksn
Copy link
Contributor

QA
Branch?6.4
Bug fix?yes
New feature?no
Deprecations?no
IssuesFix#53669
LicenseMIT

During deployment some people will compile their assets with Asset Mapper then delete the rootassets/ 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 whilekernel.debug is equal to true, letting developers know locally that there's an issue, but allowing people to safely do this in theirproduction environments.

@smnandre
Copy link
Member

With this PR, if someone runs the following command what would happen, exceptions would not be thrown if some directory is missing ?

APP_ENV=prod sf asset-map:compile

@rynhndrcksnrynhndrcksnforce-pushed thefix-assetmapper-missing-assets-dir-exception branch from79e49d8 to962a044CompareJanuary 31, 2024 23:41
@rynhndrcksn
Copy link
ContributorAuthor

rynhndrcksn commentedFeb 1, 2024
edited
Loading

@smnandre I've attached 2 screenshots of what happens when theAPP_ENV=prod symfony console asset-map:compile command is ran.

If theassets/ directory is in place, then this is the output (as expected):

APP_ENV=prod symfony console asset-map:compile being ran with an assets/ directory

If theassets/ directory is missing, then this is the output:

APP_ENV=prod symfony console asset-map:compile being ran with no assets/ directory

So during the deployment/asset compilation process people will still be notified if theassets/ directory is missing :)

@smnandre
Copy link
Member

@smnandre I've attached 2 screenshots of what happens whenAPP_ENV=prod symfony console asset-map:compile command is ran.
So during the deployment/asset compilation process people will still be notified if theassets/ directory is missing :)

Perfect for me, thank you very much 👍

rynhndrcksn reacted with thumbs up emoji

@nicolas-grekas
Copy link
Member

Thank you@rynhndrcksn.

@nicolas-grekasnicolas-grekas merged commit30a02c4 intosymfony:6.4Feb 1, 2024
@@ -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

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

Copy link
ContributorAuthor

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.

Screenshot of a 500 internal server 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?

Copy link
Member

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.

This was referencedFeb 27, 2024
@rynhndrcksnrynhndrcksn deleted the fix-assetmapper-missing-assets-dir-exception branchJune 19, 2024 02:51
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@weaverryanweaverryanweaverryan left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@stofstofstof left review comments

@smnandresmnandresmnandre left review comments

Assignees
No one assigned
Projects
None yet
Milestone
6.4
Development

Successfully merging this pull request may close these issues.

6 participants
@rynhndrcksn@smnandre@nicolas-grekas@weaverryan@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp