-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Pretty URL Router fails to clear cache if ENV var only exists in PROD #6509
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
i can't reproduce it if i do inject the non-exist env-var which is a typo, I get the same error as yours. |
I deployed it twice, with the only difference being the EA route config enabled in one deploy (failed one) and it being disabled in the second one (successful one). I'll see if I can build a reproducer though |
i tried to remove EA routes config but still have non-exist env-var, there's no error while cache clear but I get 404 while accessing the page where I do inject the service. can you confirm this? |
https://github.com/KDederichs/sf-reproducer/tree/ea/env There you go. run While writing this I also found the cause, I do not have that secret set in dev mode (only prod). The issue here is though that it'll run the |
yes, having the env-var on prod only and composer install on dev will raise the error. glad that you found the cause |
It shouldn't raise that error though is my point. It didn't before and shouldn't start doing so now |
the title should be AFAIK. in the previous version. the crud controller is registered to the service container but it has not been initialized because it is not being used anywhere in the cache warmup |
AFAIK you can't tell composer to clear the cache after install in prod mode though? At least I've never seen it. |
you can, do check https://symfony.com/doc/current/deployment.html#c-install-update-your-vendors on the orange caution box |
Note: we don't generate/cache the routes in a cache warmer ... we cache the routes (using this method: https://github.com/EasyCorp/EasyAdminBundle/blob/4.x/src/Router/AdminRouteGenerator.php#L373-L398) after generating them in the custom route loader. We use EasyAdminBundle/src/Resources/config/services.php Lines 204 to 206 in 8c88ce1
|
I think I'm experiencing a similar issue. With pretty url routes the cache fails to clear in my CI with the message In some easyadmin controllers I'm injecting some services that depend on redis for some stats and so. If cache warming needs to instantiate those controllers, it needs to bring up more things that are not available when running phpunit tests, at least in my case. |
We're encountering the same issue, where some controllers expect Redis or MySql. Now this is initialised by EasyAdmin, while it it isn't available in build steps already. Will this be different in next major release? EasyAdmin 5? |
We're experiencing an issue that may be related to this one. We build a Docker image for our project - previously to enabling pretty URLs everything went fine, but now the process fails when executing
|
Same issue I think. IMO it should do this the first time the production app actually serves a request (which then might take a second longer but if it's cached after no big deal I'd say) |
Describe the bug
Pretty URL router doesn't seem to like env vars that are stored in secrets (https://symfony.com/doc/current/configuration/secrets.html). When enabling the new router deploys will fail with the error below.
To Reproduce
Inject a Service that relies on an env that's stored in a secret into a CRUD controller via constructor.
(OPTIONAL) Additional context
The text was updated successfully, but these errors were encountered: