This blog is about how to set up Cloudinary Storage for your Heroku App. I decided to wrote a blog about it because I experienced some difficulty with getting my Cloudinary Storage to work after I deployed my аpp to Heroku. My app with connected Cloudinary Storage was properly worked on localhost but after I deployed my app to Heroku it stopped uploading user photos to Cloudinary Storage Service. I investigated what happened and found the reason.
If your app has any third parties connected to it (like storage services or databases) you have to let Heroku know about that.
- On Heroku website, go to you Personal (dashboard)
- Click on your App name.
- Go to Resources Tab and you will see adds-on.
Find Cloudinary add-ons or do it from your terminal with next command:
heroku addons:create cloudinary
It connects your Heroku app to a NEW Cloudinary account! Unfortunately I did not find the way to add your existed Cloudinary account, so I just needed to do some changes in my app, I switched all references (credentials) to my old Cloudinary account for my new one.
Next step is to provide Heroku with the API keys and secret (config variables)
Cloudinary configuration parameters (cloud_name, api_key, api_secret) are defined via the CLOUDINARY_URL configuration variable. You can find it on your dashboard on cloudinary web site.
Copy the environment variable to clipboard.
Go back to Heroku web site to Setting Tab and click on Reveal Config Vars.
Paste your Cloudinary variable from your clipboard.
This is it! Your Heroku App is connected to Cloudinary Storage.
By the way you can set your config variable from your terminal. Here are a list of command that might be useful.
heroku config — to find out your config variables
heroku config:set CLOUDINARY_URL=<your variable> — to set config variable
heroku config:remove CLOUDINARY_URL — to remove variable