canvas-lms icon indicating copy to clipboard operation
canvas-lms copied to clipboard

NoMethodError: undefined method `map' for nil:NilClass

Open nkokkos opened this issue 12 years ago • 11 comments

Hi, I am getting a NoMethodError while trying to install Canvas latest stable version.

NoMethodError: undefined method map' for nil:NilClass /home/rails_projects/new_instructure/canvas-lms/config/environments/production.rb:17:in eval' production.rb:17 -> eval(File.new(File.dirname(__FILE__) + "/cache_store.rb").read)

Have you seen this before? Thank you

nkokkos avatar Sep 08 '14 09:09 nkokkos

Hey @nkokkos, this is happening because you have no redis servers specified in either cache_store.yml or redis.yml. 7d1e9e81b18643c7e660564565086d428dbd310b is a commit that will restore the previous behavior of skipping redis initialization if no servers are specified, but it might mean there is an underlying issue with your caching setup.

simonista avatar Sep 08 '14 14:09 simonista

Thank you @simonista but the configurations for my cache_store.yml and redis.yml are fine.

Everything was working fine up until 2014-9-6.8 release.

The main culprit is lib/canvas.rb where it fails at https://github.com/instructure/canvas-lms/blob/stable/lib/canvas.rb#L74

If I copy lib/canvas.rb from 2014-9-6.8 release, then everything is back to normal.

nkokkos avatar Sep 09 '14 07:09 nkokkos

Difference between releases 2014-9-6.8 and 2014-9-6.21 for /lib/canvas.rb https://gist.github.com/nkokkos/7584bc084da687334bbb

nkokkos avatar Sep 09 '14 08:09 nkokkos

Like simonista said, that error indicates that you specified redis in your config for the given environment (development/test/production), but didn't specify any redis servers for that environment. Previous this was silently ignored, but it's actually indicative of a config problem. If you wanted to paste your redis.yml and cache_store.yml, we could help you track down how to fix the config. Or, like he said, you could apply https://github.com/instructure/canvas-lms/commit/7d1e9e81b18643c7e660564565086d428dbd310b , but you probably want to fix the config issue.

codekitchen avatar Sep 09 '14 14:09 codekitchen

Could you apply https://github.com/ccutrer/canvas-lms/commit/f31f46f4f7db996c520bc274ddb9beb66054fa0c and try again. That should get you a full stack trace, so that we can be sure it's a configuration error.

ccutrer avatar Sep 09 '14 15:09 ccutrer

Thank you @ccutrer @codekitchen

Applying the https://github.com/ccutrer/canvas-lms/commit/f31f46f4f7db996c520bc274ddb9beb66054fa0c patch still does not fix my problem.

In a nutshell:

My cache_store.yml and redis.yml follow below:

cache_store.yml: cache_store

redis.yml: redis_yml

Canvas-lms is at the latest release and after booting up canvas in production, it fails at:

`` /home/canvas_user/rails_projects/new_instructure/canvas-lms/lib/canvas.rb:98:inblock in cache_stores': undefined method map' for nil:NilClass (NoMethodError) from /home/canvas_user/rails_projects/new_instructure/canvas-lms/lib/canvas.rb:74:ineach' from /home/canvas_user/rails_projects/new_instructure/canvas-lms/lib/canvas.rb:74:in cache_stores' from /home/canvas_user/rails_projects/new_instructure/canvas-lms/config/environments/cache_store.rb:11:inblock in <top (required)>' from /home/canvas_user/rails_projects/new_instructure/canvas-lms/config/environments/production.rb:18:in eval' from /home/canvas_user/rails_projects/new_instructure/canvas-lms/config/environments/production.rb:18:in`block in <top (required)>'

``

nkokkos avatar Sep 10 '14 09:09 nkokkos

I am really sorry. I found out that in cache_store.yml, the "servers:" key is not enabled. It works now. Thank you for all your help. It was a configuration issue after all.

nkokkos avatar Sep 10 '14 12:09 nkokkos

No worries, glad we got it sorted out

codekitchen avatar Sep 10 '14 14:09 codekitchen

Hello, I get the exact same error as nkokkos and as simonista and codekitchen said applying 7d1e9e8 solves it all. Still, uncommenting servers tag in cache_store does not make it work better. How should my cache_store look like with the latest stable version? Thanks!

aureliencroq avatar Sep 15 '14 07:09 aureliencroq

That's from a working copy of cache_store.yml using the latest canvas release. Due to my not knowing how to introduce space bar spaces in markdown, please replace '$' with one space bar

cache_store.yml:

production: $$cache_store: redis_store $$servers: $$$$- redis://localhost $$database: 1

You should have a "- redis://localhost" part in redis.yml too.

nkokkos avatar Sep 16 '14 08:09 nkokkos

@aureliencroq Please see here, this is a working set of cache_store and redis.yml file setup https://gist.github.com/nkokkos/4f8c8d56bba3762a11fa

nkokkos avatar Sep 16 '14 08:09 nkokkos