filestack / filestack-ruby

Official Ruby SDK for Filestack - API and content management system that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.
https://www.filestack.com
Apache License 2.0
34 stars 27 forks source link

Uploading from local file always returns handle as nil #40

Closed anthonyto closed 5 years ago

anthonyto commented 5 years ago

Uploading a file from a local path is consistently returning a FilestackFileLink with handle nil. I'm on a Rails project using the filestack-rails gem. Uploading from an external URL works fine.

Here is the behavior I'm seeing:

# in rails console
$ security = FilestackSecurity.new('secret', options: {expiry: 1546250400, call: %w[read store pick]})
$ client = FilestackClient.new('apikey', security: security)
$ client.upload(filepath: '/path/to/image/cat.jpg')  
[##########################################################################################] [1/1] [100.00%] [00:11] [00:00] [0.09/s]
=> #<FilestackFilelink:0x00007fb159600ad8
 @apikey="<text>",
 @handle=nil,
 @security=
  #<FilestackSecurity:0x00007fb159102518
   @policy="<text>",
   @signature="<text>">>

I'm not getting any errors, simply a returned FilestackFileLink with a nil handle.

anthonyto commented 5 years ago

Attempting the "normal upload" without security from the examples produces the same result:

[13] pry(main)> client = FilestackClient.new('api_key')
=> #<FilestackClient:0x00007fb1533c71c8 @apikey="api_key", @security=nil>
[14] pry(main)> filelink = client.upload(filepath: '/path/to/image/cat.jpg')
[#################################################################################################################################################################] [1/1] [100.00%] [00:02] [00:00] [0.40/s]
=> #<FilestackFilelink:0x00007fb15b30e918 @apikey="api_key", @handle=nil, @security=nil>
gabifija commented 5 years ago

@anthonyto could you please check if you have turn on security in your application? Go to Menu Tab > Security > Policy & Signature and then setup Use Security

anthonyto commented 5 years ago

I tried it both with and without security turned on from my Filestack dashboard. In my first code example above I had security turned on, then in the second example I had manually turned it off.

gabifija commented 5 years ago

@anthonyto I reproduced your issue but for my application everything works correctly. Could you please contact our support team and provide more details, for instance: APIKEY. We can take a look on your application.

gabifija commented 5 years ago

@anthonyto Please check our latest version (2.5.4). We updated some changes. It should help you with the issue. If not, contact our support and provide your APIKEY.