AWS Rails Application Failure to deploy error

Here are the logs for eb deploy failure. It appears to be something with precompiling. I ran into similar issue with Heroku and haven't been able to solve either of them. Localhost launches fine but pre-compiling is not working due to UTF-8 format. I'm not too sure though as to how to proceed. Any suggestions would be greatly appreciated.

      mexil@nach:~/workspace/dryit$ eb deploy
Creating application version archive "app-80bb-160223_122919".
Uploading dryit/app-80bb-160223_122919.zip to S3. This may take a while.
Upload Complete.
INFO: Environment update is starting.                               
INFO: Deploying new version to instance(s).                         
ERROR: [Instance: i-9d55f345] Command failed on instance. Return code: 1 Output: (TRUNCATED)...b assets:precompile' webapp
+ '[' false == true ']'
+ su -s /bin/bash -c 'bundle exec rake assets:precompile' webapp
rake aborted!
ArgumentError: invalid byte sequence in UTF-8

Tasks: TOP => assets:precompile
(See full trace by running task with --trace). 
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/11_asset_compilation.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
ERROR: Unsuccessful command execution on instance id(s) 'i-9d55f345'. Aborting the operation.
ERROR: Failed to deploy application.                                

Upvotes: 1

Views: 1301

Answers (1)

Not sure what's causing the byte issue, I'm guessing it's some weird character somewhere, but anyways, here's a possible work around:

First, go to the environment in your AWS console, and hit on the gear thing for Software Configuration. There should be a key value pair where the key is "RAILS_SKIP_ASSET_COMPILATION" with the value "false". Change it to "true" (or if it's not there, enter it).

Then in your app, edit your production environment (config/environments/production.rb), so it says "config.assets.compile = false".

Last, in the command line enter "rake assets:precompile", then commit the changes to your git repository and you should be good to go. Just remember to manually precompile your assets if you change them in the future.

Upvotes: 2

Related Questions