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
Bundle dependencies of dev dependencies are registered in all environments #329
Comments
Maybe we should add a feature in Flex that allow specifying somewhere that a package should be registered in |
@Pierstoval I think it has more to do with the fact that recipes for profiler's dependencies register their bundles in all environments. Which makes sense when you installl TwigBundle. A bit less when you install something else that depends on TwigBundle. |
Hi, guys Could you please give me an advice? EC2 : /var/log/eb-activity.log
I have checked the error message following $composer install --no-dev --optimize-autoloader
|
I have updated the symfony/flex (v1.0.70 => v1.0.71) and I have checked it following.
I think that we need to check three bundles following
Could you please give me an advice? |
Make sure you APP_ENV environment bar is set to prod on your server before running composer install. I believe it’s not, so the cache clear post-install cmd is trying to boot Symfony in the dev environment and thus reference the DebugBundle |
About the original issue, yea, I don’t like this :/. It seems like Flex would need to become a bit “dynamic” and change the recipes based on if it’s a dev install or not... which is probably not something we want to do. What if Flex could detect when a recipe will enable a bundle in “all” environments, but that dependency was installed as a dev dependency? It could then throw an annoying warning that you should require that demo as a non dev dep, at least |
Maybe we aren't looking at this problem through the right angle. Most of the time this problem will happens because of the profiler -> twig bundle dependency. Maybe this is this dependency that should be solved. (It would solve the problem of people requiring the profiler bundle instead of the profiler pack at the same time). It could be solved by making the profiler use its own twig instance. This would have the additional benefits of stopping the profiler twig extension from beeing leaked into the "application" twig environment (this hurts the dev/prod parity). And in the opposite direction prevent user extensions from breaking the profiler. This would need some work to do it without breaking BC (because some bundles could have profiler templates that require a extension registered into the application twig instance) but I think it can be done. |
Hi @weaverryan , @jvasseur Thank you for your information. I hope that this issue can be resolved. In my case, I can't deploy my new web application using SF4.0.6 to Elastic Beanstalk on AWS. Maybe, If someone had the same issue, their application would not be deployed to production servers. Let me know if you need any information about testing it. |
I have tested this issue after installing Symfony Demo Application 4.0.6 . but I am considering that It seems to be the same issue.
composer.json
package.json
|
Hi guys, I am testing to check the issue after updating some package following.
I don't understand what it is different following
A minute ago, I have checked that it is normal when I use a command "$ APP_ENV=prod composer install --no-dev --optimize-autoloader" on PhpStorm, but I can't deploy my application to Elastic Beanstalk of AWS.
I think it that It is the related issue.
I am going to check what is different mean online. and I try to search information about "auto-scripts" from composer.json. |
I think the only way to fix this issue is for Flex to pass down a context of whether the package was installed as a regular dependency or a dev dependency (if Composer makes that information available). Two possible approaches:
|
I am writing to share my information how to deploy my application using SF4.0 to Elastic Beanstalk on AWS. (1) I have modified a file that It was ".gitignore" following.
I think that we need to consider updating some code of the file. because If There was following, I could have a problem that an application can't be deployed.
(2) I have been using a command when an application is deployed following.
so, I have updated a shell script file on my laptop
I have been using this way for 3 weeks. as result, I have not found any issues with deploying Apps on AWS. |
@xsuntel You do not need to use Here is where things break. When you run |
Hi @msheakoski |
@msheakoski the solution of switching And then if you manage to implement that logic it became even more complicated because if you install the profiler pack and then the twig bundle in non-dev environment, you have to revert these changes to make the bundle work as expected. |
I think we're running into the same issues.
As a solution, we are only registring the "all" bundles at this moment and not the dev-bundles anymore in bundles.php. In our case it was the Maker-bundle which causes problems when running
By reverting bundles.php after doing a |
I am having same issue as above. I did try to follow some of the suggestions but without success. Just to recap, when running:
The following error is thrown:
I appreciate any help. My environment:
The bundles.php file:
And finally, relevant portions of composer.json
|
I think there is nothing we can do here - that's just normal composer behavior - nothing related to flex itself. My recommendation to proper deps management in this situation would be one of:
|
For future reference, what solved the issue for me was moving symfony/dotenv from require-dev to require, as per the documentation .
|
@BernardA Thank you for your reply, I had .env missing which means the APP_ENV was missing. So Symfony was falling back to dev mode. Thanks. |
What I don't get is how symfony decides (for the bundles.php) what is and what is not a dev or production environment? To illustrate, the relevant parts of
and the bundles.php (with a modified setting for
Now when I deploy with an |
Update: There indeed doesn't seem to be such a notion. @weaverryan's comment was confusing in that regard. I don't have any knowledge about The next problem will then most likely be the In this specific case, I don't know how best to fix this, but I don't think all those related tickets on this behavior warrant to be closed. |
When you build an api you don't want to have twig in production. In dev env you might need twig because it is required for the profiler. When we require twig --dev it is installed in dev and the config file is setup for all environment. That made me crazy once upon a time because the error message was displaying another bundle's name. Now i have currently solved the problem. No Twig. No Profiler. ¯_(ツ)_/¯. Or manually set in bundles.php [dev => true, test => true]. |
try to install symfony/twig-pack it helps |
I stumbled upon this while trying to install
debug
to a project based offsymfony/skeleton
. Everything worked fine in a dev environment, but when trying to run in prod it blows up due to some bundles missing.Steps to reproduce:
The last command will fail with:
That's because TwigBundle and MonologBundle were brought by the WebProfilerBundle.
Honestly, I don't think this can be easily fixed in flex, but maybe someone will have an idea.
A manual solution is to update bundles.php to register twig and monolog bundles in dev/test environments only, and then move the config files.
The text was updated successfully, but these errors were encountered: