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?

Arenzel
  • 1,156
  • 1
  • 11
  • 18

3 Answers3

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.

trh
  • 7,186
  • 2
  • 29
  • 41
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.

geemus
  • 2,522
  • 16
  • 22
  • Why not just add 'unf' as a dependency in fog? – Karl Baum Dec 02 '13 at 13:23
  • The conversation on Github reveals they're trying to limit needles dependencies. "I use Fog with Rackspace Cloud, why do I need unf?" –  Dec 03 '13 at 15:59
  • 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. – geemus Dec 10 '13 at 19:35
  • If you are not using AWS and you can upgrade to fog 1.19.0 and the warning will go away. @geemus made a commit (https://github.com/fog/fog/commit/e9a72f1c9e5fbf30ebec7f507a98a927dc3131c9) that throws the warning only if you are using AWS. – bennick Jan 09 '14 at 00:25
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.

dman
  • 1,089
  • 13
  • 9