Paperclip-dropbox gem not allowing access - ruby-on-rails

my rails app is configured to use the app_folder access but when I try to upload a file in development, Rails throws me this error:
Host: rpc.dropbox.com:443, FE: None, X-Dropbox-RequestId: None, X-Dropbox-App-Error: None, Full Dropbox access attempt failed because this app is not configured to have full Dropbox access. Should your access type be app folder ('sandbox') instead?
At first I thought maybe I entered the value wrong. My variable looks like this:
DROPBOX_ACCESS_TYPE: app_folder
Any ideas?

Janko, the creator of the gem solved it by telling me to update the gem

Related

Internal server error response during rails omniauth docusign callback

I am connecting to DocuSign via oauth with Rails 6 and Omniauth - it seems I have it configured correctly since visiting /auth/docusign takes me to the DocuSign login screen. After logging in, it takes me to the callback. The callback is failing because the omniauth-docusign gem is failing with the user_info hash. Where it should be getting user_info['accounts'] it is getting this:
user_info #=> {"error"=>"internal_server_error", "reference_id"=>"a0f0e8c9-2faa-4b70-90b8-875ae40f13cf"}
My API Dashboard for the App shows no log or request info. 0 total requests. Is there a log area for oauth attempts, or where to use this reference ID?
Can someone at DocuSign help with this? Your developer support page seems to say to ask here on S/O.
It appears that you didn't configure everything correctly for your Integration Key (IK which is like clientId) as well as clientSecret and the rest of the configuration that you can do for your IK.
I would suggest that you can get a pre-built Ruby application that already had this all done for you and save you some work by going to the Quickstart. This would enable you to go get a ZIP file pre-configurated with all the required gems and everything needed for auth already set based on your own developer account.
Update: if you then want to take this code into your own app, you need to also get the authentication code supplied lib/docusign.rb instead of a gem like omniauth-docusign.
As Inbar Gazit said, it's important to use the Quickstart app, which I was doing. However, not only do I already have my own existing rails app, even if I didn't, I wouldn't want to have to clean out all the extra stuff in the quickstart app that I don't need. It would be nice to have a minimal script for installing just the bare minimum into an existing rails app to get authenticated and start using the API.
In the end, the solution for me was to notice and copy the lib/docusign.rb file from the Quickstart app, instead of using an omniauth-docusign gem. The base omniauth gem had advised me to find and install that gem because there was no strategy defined for docusign. The quickstart lib file is what I needed.

Ruby on Rails application - No such file to load

I'm trying to bring up an old Ruby on Rails application from a crashed server, and when I try to access it via the browser, I get this screen:
For copy-and-paste / searchability, here's the text:
Ruby on Rails application could not be loaded
---------------------------------------------
A source file that the application requires, is missing.
It is possible that you didn't upload your application files correctly. Please check whether all your application files are uploaded.
A required library may not installed. Please install all libraries that this application requires.
Further information about the error may have been written to the application's log file. Please check it in order to analyse the problem.
Error message:
no such file to load -- active_record/locking/optimistic
Exception class:
LoadError
Application root:
/srv/---REDACTED---/current
Backtrace:
---the backtrace---
That first line mentioned in the backtrace is:
include Locking::Optimistic, Locking::Pessimistic
So it's looking for active_record/locking/optimistic, which I found in a variety of other locations:
/data/srv/---REDACTED---/shared/bundle/ruby/1.8/gems/activerecord-3.0.20/lib/active_record/locking/optimistic.rb
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.20/lib/active_record/locking/optimistic.rb
/var/lib/gems/1.8/gems/activerecord-3.0.20/lib/active_record/locking/optimistic.rb
My problem is that I have no idea how to tell Ruby where to go look for the files it thinks are missing. I am not a Ruby person and I don't know how Phusion Passenger runs things, but I know most languages have concepts of "paths" to search and I'm assuming I just need to set a path somewhere.
Any ideas?
I ended up manually copying over the missing files from the
/data/srv/---REDACTED---/shared/bundle/ruby/1.8/gems/activerecord-3.0.20/lib/active_record/locking/optimistic.rb
...to the gem that was reporting the missing file, since it seemed to be the same gem and same version.
Running the bundle install didn't change anything, for some reason.

Creating a ruby gem requiring an API key from user

I am building my first ruby gem for a service which requires the use of an API key from the user,
so I would like to know what should I do to let the user give his own API key to the gem when he installs it?
Thanks :)
Let users of your gem put the API key in config/yourgem_config.yml
# yourgem_config.yml
api_key: 1233456
From your gem, load this YAML file, and use the api_key that is specified.
Optionally fall back so some other sort of API access, when the config file can not be found, or provide a error message.
Optionally let the user configure the path to the config file.

Unable to save file to Amazon S3 when using carrierwave

SEE UPDATE BELOW!
I am having problems after I upload an image file to Amazon S3 and then try to save the file.
I use direct_fog_url(with_path: true) to get the the url of the image uploaded. I then get the following error:
ActiveRecord::RecordInvalid Validation failed: Image could not download file
I saw these two possible solutions:
https://github.com/jnicklas/carrierwave/issues/700
http://www.github.com/jnicklas/carrierwave/issues/888
But neither one seems to work.
Im using the older deleted command: overwriting method process_uri (enter link description here):
def process_uri(uri)
URI.parse(URI.escape(URI.unescape(uri)).gsub("[", "%5B").gsub("]", "%5D").gsub("+", "%2B"))
end
In my application I am using the following Gems:
gem 'fog'
gem 'carrierwave'
gem 'carrierwave_direct'
gem 'rmagick'
Thanks!
UPDATE: After implementing #Alex's answer below we resolved that problem but now when we do the upload we get the following error:
Excon::Errors::MovedPermanently
PermanentRedirect
The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
For your Excon::Errors::MovedPermanently issue, make sure that you have the right data center region configured in your carrierwave.rb file. For example, if you're hosted on us-west, your region needs to be set to us-west.
Have you found a solution to this problem yet?
I'm facing the same problem here, I'm trying to fetch a remote URL with carrierwave (not on S3) and I get the notorious 'could not download file' error:
Validation failed: Image could not download file
[...]/gems/activerecord-3.2.9/lib/active_record/validations.rb:56:in `save!'
Could you post your URL to see what special characters there are?
EDIT: I found a solution. My case required that I did not change or escape the uri at all. I found that by adding 'return' to the 'def process_uri(uri)' method it works just fine.
Just in case this is useful to someone else, this is my overriding method in my uploader class:
def process_uri(uri)
return URI.parse(uri)
end

Write permission error with Heroku + Activeadmin

I am running into a permissions error only when I try to run my app on heroku. My app works perfectly on my local machine but when I push it to heroku, I get a write error in the logs:
2011-10-27T16:55:14+00:00 app[web.1]: Errno::EACCES (Permission denied - /app/public/stylesheets/active_admin.css):
I am not quite sure how to fix this since it works on my local machine. Why would this file need public write permissions?
EDIT: Why would activeadmin need write access to that file? How do I work around that?
Heroku has a read only file system. See http://devcenter.heroku.com/articles/read-only-filesystem
If you make a new app on cedar, you'd be able to write, but it won't stick around. See http://devcenter.heroku.com/articles/dyno-isolation#ephemeral_filesystem
If you continue to have problems, you should contact support http://suport.heroku.com
ActiveAdmin uses Sass and tries to compile it live, but Heroku disallows this.
To fix, I have this at the top of config/initializers/active_admin.rb (outside of the ActiveAdmin.setup block):
Sass::Plugin.options[:never_update] = true
Source: https://github.com/gregbell/active_admin/issues/44#issuecomment-1305038
Another workaround would simply be to save the active_admin.css file (when you're on your local machine) and simply upload it to your css folder.
I have the same problem and I found this initializer to fix the path for the CSS file.
https://gist.github.com/1012619
It's work perfect for me.

Resources