Strapi V4.0.6 Heroku Cloudinary - Error 500 when uploading images in production

System Information
  • Strapi Version: 4.0.6
  • Operating System: Windows 10
  • Database: POSTGRES
  • Node Version: 16.13.2
  • NPM Version: 8.1.2

I connected Strapi with cloudinary following these instructions: @strapi/provider-upload-cloudinary

The upload is working great in local. But as soon as I push it to heroku, I get an “error 500” on upload (see image below)

Any idea why ?

More infos below:

  • config/middleware.js
module.exports = [
    name: 'strapi::security',
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          'connect-src': ["'self'", 'https:'],
          'img-src': ["'self'", 'data:', 'blob:', ''],
          'media-src': ["'self'", 'data:', 'blob:', ''],
          upgradeInsecureRequests: null,
  • config/plugins.js
module.exports = ({ env }) => ({
    // ...
    upload: {
        config: {
        provider: 'cloudinary',
        providerOptions: {
            cloud_name: env('CLOUDINARY_NAME'),
            api_key: env('CLOUDINARY_KEY'),
            api_secret: env('CLOUDINARY_SECRET'),
        actionOptions: {
            upload: {},
            delete: {},
    // ...

Thank you in advance and have a good day :smiley:

Did you forget to set environment variables in Heroku?

1 Like

@mckennapaul27 Alright, it’s monday and I didn’t get enough sleep ! I indeed forgot the env variables in Heroku :sweat_smile:
Thanks and have a nice day :slight_smile:

1 Like

Hello, i have the same issue, how did you set the env variables ??


Hi @Diop_Nikuze ,

Not sure if you have figured this out but to fix this error, head over to your Heroku dashboard, click on the project and then under settings you will see a section called Config Vars. Add your CLOUDINARY_KEY, CLOUDINARY_NAME and CLOUDINARY_SECRET there. This should fix the problem.

1 Like

Thanks alot @ Franco_Labuschagne you answer helped me with the same problem.

what i did was exactly as you said it.

And it worked so thank you.

1 Like