Neil
Neil

Reputation: 569

Rails 4: KeyError (:access_token_secret credential is nil): using paperclip dropbox gem

Trying to upload files using the paperclip-dropbox gem. Works in localhost but when i try on heroku i get error KeyError (:access_token_secret credential is nil):

 KeyError (:access_token_secret credential is nil):
2014-04-29T20:27:00.982579+00:00 app[web.1]: Started POST "/listings" for 92.5.114.214 at 2014-04-29 20:27:00 +0000
2014-04-29T20:27:00.991481+00:00 app[web.1]: Completed 500 Internal Server Error in 3ms
2014-04-29T20:27:00.982590+00:00 app[web.1]: Started POST "/listings" for 92.5.114.214 at 2014-04-29 20:27:00 +0000
2014-04-29T20:27:00.987444+00:00 app[web.1]: Processing by ListingsController#create as HTML
2014-04-29T20:27:00.992963+00:00 app[web.1]: 
2014-04-29T20:27:00.992964+00:00 app[web.1]: **KeyError (:access_token_secret credential is nil):**
2014-04-29T20:27:00.992968+00:00 app[web.1]: 
2014-04-29T20:27:00.992956+00:00 app[web.1]:   app/controllers/listings_controller.rb:27:in `create'
2014-04-29T20:27:00.988120+00:00 app[web.1]:   Parameters: {"utf8"=>"✓", "authenticity_token"=>"I7v0J20Qv8IX7bl47AOssqFvv7xaO+X/JqJ1YGZF0Ig=", "listing"=>{"name"=>"test", "description"=>"test", "price"=>"12", "image"=>#<ActionDispatch::Http::UploadedFile:0x007f502b6ed980 @tempfile=#<Tempfile:/tmp/RackMultipart20140429-2-1u8n0ay>, @original_filename="applemac.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"listing[image]
"; filename=\"applemac.jpg\"\r\nContent-Type: image/jpeg\r\n">}, "commit"=>"Create Listing"}

heroku config shows

ACCESS_TOKEN_SECRET:        m7r66o1it3xxxxx
APP_SECRET:                 incev12hukxxxxx
DATABASE_URL:               postgres://fklmdpqvdabc:5MPF_gpvHqsxqi55g5kQEEpttD@ec2-54-83-201-54.compute-1.amazonaws.com:5432/ddsldn4k8ve16o
HEROKU_POSTGRESQL_TEAL_URL: postgres://fklmdpqvdabc:5MPF_gpvHqsxqi55g5kQEEpttD@ec2-54-83-201-54.compute-1.amazonaws.com:5432/ddsldn4k8ve16o
LANG:                       en_US.UTF-8
RACK_ENV:                   production
RAILS_ENV:                  production

and the application.yml

APP_SECRET: "incev12huxxxxxx"
ACCESS_TOKEN_SECRET: "m7r66o1xxxxxxx

dropbox folder

app_key: "3b0nq7axxxxxxxx"
app_secret: <%= ENV["APP_SECRET"] %>
access_token: "v30cwshpxxxxxxx"
access_token_secret: <%= ENV["APP_TOKEN_SECRET"] %>
user_id: "3xxxxxx"
access_type: "app_folder""

Upvotes: 0

Views: 582

Answers (1)

Kirti Thorat
Kirti Thorat

Reputation: 53038

Update

access_token_secret: <%= ENV["APP_TOKEN_SECRET"] %>

To

access_token_secret: <%= ENV["ACCESS_TOKEN_SECRET"] %>

You have set the key ACCESS_TOKEN_SECRET BUT are using key APP_TOKEN_SECRET. ENV[APP_TOKEN_SECRET] return nil as it doesn't exist. Hence, the error.

Upvotes: 1

Related Questions