Warning with fog and AWS: unable to load the 'unf' gem
Asked Answered
S

3

59

Every action in a rails console (rails server, rails console, db:migrate, etc.) raises a warning since my last bundle update:

[fog][WARNING] Unable to load the 'unf' gem. Your AWS strings may not be properly encoded.

I'm sure I didn't change anything in the AWS strings which are in my application.rb file:

    # Amazon S3 credentials
ENV["AWS_ACCESS_KEY_ID"] = "AWS_ACCESS_KEY_ID"
ENV["AWS_SECRET_ACCESS_KEY"] = "AWS_SECRET_ACCESS_KEY"
ENV["AWS_S3_BUCKET"] = "my-bucket"

I don't have this "unf" gem in my gemfile. Should I add it?

Segmental answered 29/10, 2013 at 18:22 Comment(0)
M
74

Yes, this just happened a few days ago. You can see from the pull request and commit that the unf dependency is optional.

https://github.com/fog/fog/pull/2320/commits

When I updated my current bundle with fog I received the same warnings, and adding

gem 'unf' 

does indeed remove the warning without any issues.

Motherhood answered 29/10, 2013 at 18:38 Comment(0)
C
13

If you do not have any S3 buckets/objects that would have not ASCII characters in the names, I think you can safely disregard the warning. We may do something to make it less noisy also, but for now you can ignore or add unf to quiet it down, as @trh pointed out.

Chloroprene answered 30/10, 2013 at 0:30 Comment(4)
Why not just add 'unf' as a dependency in fog?Masked
The conversation on Github reveals they're trying to limit needles dependencies. "I use Fog with Rackspace Cloud, why do I need unf?"Benyamin
Correct. Would just include it if it was widely needed, but since only AWS (and only in limited contexts) needs it, it seemed bad/heavy handed to make everybody include it. Not a great situation in general, but this seemed the lesser evil.Chloroprene
If you are not using AWS and you can upgrade to fog 1.19.0 and the warning will go away. @Chloroprene made a commit (github.com/fog/fog/commit/…) that throws the warning only if you are using AWS.Crabtree
L
7

I apparently had fog-1.18.0 installed when I saw this error. (Restarting an aws vagrant project I installed a while ago) My naive attempt at a fix was to start with an upgrade

  gem install fog

which upgraded something to fog-1.21.0. As it warned, "This could take a while..." ... and that did not help.

Exactly WHERE to add "gem 'unf'" wasn't clear from the solution voted up here, it seemed to be lib/fog/aws.rb but that was already there when I looked.

  gem install unf

appeared to add it somewhere, but the problem did not go away.

I upgraded vagrant itself (1.4.3 to 1.5.1) and THAT didn't fix it.

Eventually, the fix was

  vagrant plugin install unf

as I found in a thread at https://github.com/mitchellh/vagrant/issues/2507

I'm not sure if any of my previous fumbling attempts were also necessary, so I noted them here anyway.

Leontineleontyne answered 22/3, 2014 at 2:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.