I am trying to get my RoR app up and running on Elastic Beanstalk and am struggling to get the rgeo gem working. The error I am getting on the web server is:
I, [2015-09-28T11:26:54.982049 #21789] INFO -- : Completed 500 Internal Server Error in 5ms (ActiveRecord: 2.6ms)
F, [2015-09-28T11:26:54.983523 #21789] FATAL -- :
NoMethodError (undefined method `point' for nil:NilClass):
lib/app/weather_service.rb:61:in `block in get_location'
....
That error happens when the code accesses a model attribute that is backed by a POINT data type in the database. The error is typically due to a missing dependency, namely geos as described in this thread. So I connected to the underlying EC2 instance, installed geos and re-installed the rgeo gem. That resolved the issue in rails console:
[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ cd /var/app/current
[ec2-user@ip-xxx-xxx-xxx-xxx current]$ rails c
Loading production environment (Rails 4.2.4)
irb(main):001:0> RGeo::Geos.supported?
=> true
That did not, however, resolve the error in the web server. I'm pretty sure I don't clearly understand the Elastic Beanstalk environment and maybe making direct changes to the underlying EC2 instance won't make dependencies available to the application instance. I do understand that I would need to either add the dependencies to either a custom AMI or ebextensions for future deployments, but I wanted to make sure I have the dependencies working before going through that process. Any guidance would be appreciated.
In case anyone else runs into this same issue, I did find a solution. These are the steps I followed: