-
Notifications
You must be signed in to change notification settings - Fork 512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gem Load Error is: undefined local variable or method `dotenv_files' #297
Comments
FWIW a hacky way to avoid this error is to add the following to module Dotenv
class Railtie < Rails::Railtie
def dotenv_files; end
end
end Note that the method is empty but it later gets overridden and the gem's behavior remains unaffected. I was not able to pinpoint what exactly causes the issue with this version. |
I'm having a similar issue on my staging server. The server is using the following:
When starting my unicorn server, the log shows the following error message:
However, when I manually downgrade Any idea of why this is happening? UpdateIt seems that in my case, the break comes from this commit #246. Version |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Can we please reopen this? This bug was reported for version 2.2.1 which is the latest, so I think it's still relevant. |
I'm running into a similar error w/ 2.2.1 (latest), minus the I'm deploying to an elastic beanstalk environment on AWS, and the error occurs when running a Things that didn't work:
Things that do work:
Assuming it's got something to do with the scripts running as root and not having a HOME environment variable set (just like the error message says) Environment: Ruby 2.3.4 Backtrace
It looks like it is related to the commit noted above, because by switching from loading I'm chalking it up to an environment issue created by not having that HOME path set, because Rescuing If @bkeepers is amenable I can fork, test, and do a PR if that resolves it. |
I just ran into this bug, FWIW. |
Just wanted to warn anyone about this hack: module Dotenv
class Railtie < Rails::Railtie
def dotenv_files; end
end
end Don't use it as it will mess your environment. This hack breaks this rule:
And you will end up with your development keys in production. To load it correctly we had to do the following to the module Dotenv
class Railtie < Rails::Railtie
def dotenv_files
[
root.join(".env.#{Rails.env}.local"),
(root.join(".env.local") unless Rails.env.test?),
root.join(".env.#{Rails.env}"),
root.join(".env")
].compact
end
end
end
if defined?(Bundler)
Bundler.require(:default, Rails.env)
end
Dotenv::Railtie.load |
Gem Load Error is: non-absolute home
|
Getting this with 2.2.0, 2.1.2 does work.
The text was updated successfully, but these errors were encountered: