Error while rebuilding discourse docker image with New Relic plugin

We upgraded Discourse docker to master and tried to rebuild the docker images for the latest updates and now we are getting an error for wrong constant name. Checkout the stacktrace below:

1:  rails_multisite (2.0.7) from /var/www/discourse/vendor/bundle/ruby/2.6.0/specifications/rails_multisite-2.0.7.gemspec
Bundle complete! 120 Gemfile dependencies, 157 gems now installed.
Gems in the groups test and development were not installed.
Bundled gems are installed into `./vendor/bundle`
I, [2019-09-24T05:09:04.662043 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
rake aborted!
NameError: wrong constant name [[:error, ["detected unsupported rails version 6.0.0"], nil]]
/var/www/discourse/plugins/new_relic-discourse/gems/2.6.4/gems/newrelic_rpm-5.4.0.347/lib/new_relic/control/class_methods.rb:52:in `const_get'
/var/www/discourse/plugins/new_relic-discourse/gems/2.6.4/gems/newrelic_rpm-5.4.0.347/lib/new_relic/control/class_methods.rb:52:in `load_framework_class'
/var/www/discourse/plugins/new_relic-discourse/gems/2.6.4/gems/newrelic_rpm-5.4.0.347/lib/new_relic/control/class_methods.rb:32:in `new_instance'
/var/www/discourse/plugins/new_relic-discourse/gems/2.6.4/gems/newrelic_rpm-5.4.0.347/lib/new_relic/control/class_methods.rb:13:in `instance'
/var/www/discourse/plugins/new_relic-discourse/plugin.rb:9:in `activate!'
/var/www/discourse/lib/plugin/instance.rb:494:in `instance_eval'
/var/www/discourse/lib/plugin/instance.rb:494:in `activate!'
lib/discourse.rb:171:in `block in activate_plugins!'
lib/discourse.rb:168:in `each'
lib/discourse.rb:168:in `activate_plugins!'
/var/www/discourse/config/application.rb:261:in `<class:Application>'
/var/www/discourse/config/application.rb:58:in `<module:Discourse>'
/var/www/discourse/config/application.rb:57:in `<top (required)>'
/var/www/discourse/Rakefile:7:in `require'
/var/www/discourse/Rakefile:7:in `<top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
(See full trace by running task with --trace)
I, [2019-09-24T05:09:12.600060 #1]  INFO -- : gem install newrelic_rpm -v 5.4.0.347 -i /var/www/discourse/plugins/new_relic-discourse/gems/2.6.4 --no-document --ignore-dependencies --no-user-install
Successfully installed newrelic_rpm-5.4.0.347
1 gem installed
I, [2019-09-24T05:09:12.600340 #1]  INFO -- : Terminating async processes
I, [2019-09-24T05:09:12.600566 #1]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/10/bin/postmaster -D /etc/postgresql/10/main pid: 50
I, [2019-09-24T05:09:12.600630 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 167
167:signal-handler (1569301752) Received SIGTERM scheduling shutdown...
2019-09-24 05:09:12.600 UTC [50] LOG:  received fast shutdown request
2019-09-24 05:09:12.603 UTC [50] LOG:  aborting any active transactions
2019-09-24 05:09:12.606 UTC [50] LOG:  worker process: logical replication launcher (PID 59) exited with exit code 1
2019-09-24 05:09:12.607 UTC [54] LOG:  shutting down
2019-09-24 05:09:12.626 UTC [50] LOG:  database system is shut down
167:M 24 Sep 2019 05:09:12.656 # User requested shutdown...
167:M 24 Sep 2019 05:09:12.656 * Saving the final RDB snapshot before exiting.
167:M 24 Sep 2019 05:09:13.094 * DB saved on disk
167:M 24 Sep 2019 05:09:13.094 # Redis is now ready to exit, bye bye...
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 423 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
772fd9749450a9f60c0342e5a823426fb81efb1ab8a83546cc38fdfddd5d8cc6
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.

try removing third party plugins to see if that is causing rebuild failure.
try running ./discourse-doctor to see if it suggests something.

I got this fixed by upgrading the version of new_relic plugin.
Thanks!

3 Likes

I bumped into exactly the same error but still couldn’t get rid of it.

I have in my app.yml file:

  NEW_RELIC_LICENSE_KEY: xxxxxxxx
  NEW_RELIC_APP_NAME: xxxxxxxx

And only (is a test instance):

        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/davidcelis/new_relic-discourse.git

How exactly did you do this?

You can define new relic gem version to use by overriding environment variable:
NEW_RELIC_AGENT_VERSION=6.6.0.358 this will override new relic version.

2 Likes

Thanks! Worked perfectly.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.