Skip to content

Activity has unexpected exception, because: no implicit conversion of nil

0

Most times I deploy, I get this error and deployment fails. Yesterday when I usde the 'application versions' tab to deploy the deployment worked as expected.

I'm using the latest golang platform version. I usually have to manually reboot and re-register these failed instances with the load balancers to try again (otherwise my entire environment is red). Yesterday 'application versions' deployments worked without this error ... I'm not sure why they'd break again today.

Looks to be a bug in the platform.

[2020-12-07T20:57:01.145Z] INFO [29598] - [Application update app-3898-201207_124042@325/AppDeploySt
age0/EbExtensionPreBuild] : Starting activity...
[2020-12-07T20:57:11.948Z] INFO [29598] - [Application update app-3898-201207_124042@325/AppDeploySt
age0/EbExtensionPreBuild] : Activity has unexpected exception, because: no implicit conversion of nil
into String (TypeError)
at /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticbea
nstalk/cfn-wrapper.rb:117:in +' from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticb eanstalk/cfn-wrapper.rb:117:in recompile_exception'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticb
eanstalk/cfn-wrapper.rb:53:in run_config_sets' from infra-embedded_prebuild.rb:20:in block in execute!'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticb
eanstalk/executable.rb:61:in instance_eval' from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticb eanstalk/executable.rb:61:in block in execute!'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticb
eanstalk/executable.rb:60:in open' from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticb eanstalk/executable.rb:60:in execute!'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticb
eanstalk/command.rb:211:in block (4 levels) in exec_stage' from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticb eanstalk/command.rb:211:in chdir'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticb
eanstalk/command.rb:211:in block (3 levels) in exec_stage' from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticb eanstalk/activity.rb:195:in call'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticb
eanstalk/activity.rb:195:in exec' from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticbeanstalk/activity.rb:140:in timeout_exec'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticbeanstalk/activity.rb:123:in block in create' from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticbeanstalk/activity.rb:122:in instance_eval'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticbeanstalk/activity.rb:122:in create' from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticbeanstalk/command.rb:208:in block (2 levels) in exec_stage'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticbeanstalk/command.rb:206:in each' from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticbeanstalk/command.rb:206:in each_with_index'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticbeanstalk/command.rb:206:in block in exec_stage' from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.12/lib/elasticbeanstalk/activity.rb:195:in call'

Edited by: fdsa on Dec 9, 2020 2:53 PM

asked 5 years ago279 views
3 Answers
0

I run into this several times a day at this point. I suspect there's some corner case in my configuration that triggers this bug but given the non-descript log and the lib not being open source I can't troubleshoot.

answered 5 years ago
0

The stack trace references what looks like a private gem. It looks like the eb is calling some script during prebuild that expects an argument "$1" and it doesn't get it (so it's nil) but attempts to concat it to a string. After calling .to_s on $1 to fix, I uncovered a race condition on "failed_key." This block is entered so failed_key must initially be truthy, yet when it's referenced in the block it's nil as well. I locally patched the gem on my instances to check if failed_key is truthy before using it like so:

            case failure  
                when failed_key && @@cfn_cmd_failed_regex  
                    name = prebuild ? "command #{$1}" : "container_command #{$1}"  
                    ret = ExternalInvocationError.new(  
                        reason: ebext_file_name ? "#{name} in #{ebext_file_name} failed." : "EBExtension #{name} failed.",  
                        output: failed_key && 'Command ' + $1.to_s == failed_key.name ? failed_key.output : '',  
                        exit_code: !failed_key || failed_key.exit_code.nil? ? 1 : failed_key.exit_code  
                    )  

It'd be lovely if I didn't have to do this. The only ebextensions I have are 2 yum installs (via "packages:"), a "sources:", "Resources" to setup s3 auth, and a "files" section for 2 files. None of those extensions error though. I also have some nginx conf but this seems like something in the yaml stuff.

answered 5 years ago
0

The issue was memory was running out during some internal eb task as I was on micro instances but it was getting reported in this weird way. This also explains why rebooting would resolve the issue. I was able to find this in the cfn logs.

answered 5 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.