Storage::S3.new doesn't work correctly without fog-aws in Gemfile?

24 views
Skip to first unread message

pe...@sigut.net

unread,
Nov 8, 2016, 1:25:01 PM11/8/16
to Shrine
Hi,

we are trying to get rid of fog-aws, because it is not longer needed in our Gemfile. We are using aws-sdk gem.

If I initialize new S3 storage with fog-aws in my Gemfile:

s3_options = {
  access_key_id
:     "abc",
  secret_access_key
: "xyz",
  region
:            "my-region",
  bucket
:            "my-bucket",
}


Shrine::Storage::S3.new(prefix: "cache", **s3_options)


=> #<Shrine::Storage::S3:0x007ff5a9ec4db0 @prefix="cache", @s3=#<Aws::S3::Resource>, @bucket=#<Aws::S3::Bucket name="my-bucket">, @host=nil, @upload_options={}, @multipart_threshold=15728640>



see that **prefix** is correctly set and **host** is nil, but when I do it without fog-aws in Gemfile:



=> #<Shrine::Storage::S3:0x007fb76d4e19f8 @prefix=nil, @s3=#<Aws::S3::Resource>, @bucket=#<Aws::S3::Bucket name="my-bucket">, @host=1, @upload_options={}, @multipart_threshold=15728640>




the prefix is nil and the host is set to "1".

The only difference is with and without fog-aws installed. 

I tried several aws-sdk versions, several shrine versions... I guess I am missing something but have no idea where to start. I appreciate any help.

Janko Marohnić

unread,
Nov 8, 2016, 11:49:25 PM11/8/16
to pe...@sigut.net, Shrine
I tried to reproduce, and the Shrine::Storage::S3 was correctly initialized for me: https://gist.github.com/janko-m/a7975a31d1fa15228eb1606e66fe5064

Could you try running that script and see if you are seeing this behaviour? If not, could you try to come up with a self-contained script which reproduces the bug?

Kind regards,
Janko

--
You received this message because you are subscribed to the Google Groups "Shrine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine+unsubscribe@googlegroups.com.
To post to this group, send email to ruby-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-shrine/2a73c920-5477-43ca-be2e-18337bffa528%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pe...@sigut.net

unread,
Nov 9, 2016, 10:37:01 AM11/9/16
to Shrine, pe...@sigut.net
This rabbit hole was very deep:)

I think it is not bug in Shrine at the end, so sorry for bothering you:(

The combination is ruby 2.2.2 + gem 'config' and 'region' key.

I created new rails app, with just aws-sdk, shrine and config gem added.

If you create any key in settings.yml with name "region", it will break the shrine (aws?) configuration as stated above:

https://github.com/petrsigut/shrine_config_region

solution is either upgrade ruby or rename the key.

I do not have knowledge to debug it more and as ruby 2.2.5 is stable, probably no need to investigate. Just posting for future generations.

Kind regards,
Petr


On Wednesday, November 9, 2016 at 5:49:25 AM UTC+1, Janko Marohnić wrote:
I tried to reproduce, and the Shrine::Storage::S3 was correctly initialized for me: https://gist.github.com/janko-m/a7975a31d1fa15228eb1606e66fe5064

Could you try running that script and see if you are seeing this behaviour? If not, could you try to come up with a self-contained script which reproduces the bug?

Kind regards,
Janko
On Wed, Nov 9, 2016 at 2:25 AM, <pe...@sigut.net> wrote:
Hi,

we are trying to get rid of fog-aws, because it is not longer needed in our Gemfile. We are using aws-sdk gem.

If I initialize new S3 storage with fog-aws in my Gemfile:

s3_options = {
  access_key_id
:     "abc",
  secret_access_key
: "xyz",
  region
:            "my-region",
  bucket
:            "my-bucket",
}


Shrine::Storage::S3.new(prefix: "cache", **s3_options)


=> #<Shrine::Storage::S3:0x007ff5a9ec4db0 @prefix="cache", @s3=#<Aws::S3::Resource>, @bucket=#<Aws::S3::Bucket name="my-bucket">, @host=nil, @upload_options={}, @multipart_threshold=15728640>



see that **prefix** is correctly set and **host** is nil, but when I do it without fog-aws in Gemfile:



=> #<Shrine::Storage::S3:0x007fb76d4e19f8 @prefix=nil, @s3=#<Aws::S3::Resource>, @bucket=#<Aws::S3::Bucket name="my-bucket">, @host=1, @upload_options={}, @multipart_threshold=15728640>




the prefix is nil and the host is set to "1".

The only difference is with and without fog-aws installed. 

I tried several aws-sdk versions, several shrine versions... I guess I am missing something but have no idea where to start. I appreciate any help.

--
You received this message because you are subscribed to the Google Groups "Shrine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages