简体   繁体   中英

AWS Elastic Beanstalk with Rails, compiled assets are not being loaded

I am getting 400 errors for pretty much all of my assets when deploying to elastic beanstalk.

Rails v 4.2

I am toying with the idea of applying symbolic links or creating a copy ebextension but I really shouldn't have to do that.

EB uses nginx and I confirmed that nginx is serving up public/assets and public directories.

I can move a file to public/assets and it will no longer error out.

Also, the application has no issue running on ec2 instances directly.

I noticed that the browser is not attempting to load the compiled versions of my assets (ex: application-03f1fea523795448f85cf1cf62e62e6f.css) when I render the page. It tries to load the uncompiled files which are not in the public/assets directory.

Any thoughts?

I have the same issue. And just want to share my thoughts.

When my RACK_ENV=development and RAILS_SKIP_ASSET_COMPILATION=false in EB Environment properties, it correspond to the configuration file from config/environments/development.rb in Rails app.

And look like when I access the app from the browser, it precompile assets twice (EB precompile script, and on run-time asset compile), therefore asset hash finger will not matched. As result in, 404 assets error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM