Rails production env "uninitialized constant (NameError)" error in unicorn startup

StackOverflow https://stackoverflow.com/questions/21584661

  •  07-10-2022
  •  | 
  •  

سؤال

My rails app fails to start when in production (using unicorn) but works perfectly fine in development.

The exact error given is:

ERROR -- : uninitialized constant Grocer (NameError)

The error is generated on a custom initializer file I have created to initialise a Grocer connection.

The problem isn't in the gem file. A 'bundle show grocer' on the server shows Grocer is installed.

'RAILS_ENV=production rails console' on the server loads correctly and Grocer is available there.

My guess is that Unicorn is missing something... Is there any reason why when the rails app is started through unicorn it can't see the Grocer gem installed? Where should I look next to help debug this further?

هل كانت مفيدة؟

المحلول

This might sound like a silly suggestion ... Have you tried restarting unicorn?

نصائح أخرى

bundle install --deployment

should do the trick

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top