[v4] Problem uploading to Cloudinary

System Information
  • Strapi Version: 4.0.6
  • Operating System: MacOS Catalina
  • Database: SQLite
  • Node Version: 14.18.3
  • NPM Version: 8.3
  • Yarn Version: 1.22.17

My setup follows all the rules outlined in the github docu here:

https://github.com/strapi/strapi/tree/master/packages/providers/upload-cloudinary#security-middleware-configuration

// middlewares.js
module.exports = [
  'strapi::errors',
  {
    name: 'strapi::security',
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          'connect-src': ["'self'", 'https:'],
          // Cloudinary
          'img-src': ["'self'", 'data:', 'blob:', 'res.cloudinary.com'],
          'media-src': ["'self'", 'data:', 'blob:', 'res.cloudinary.com'],
          upgradeInsecureRequests: null,
        },
      },
    },
  },
  'strapi::cors',
  'strapi::poweredBy',
  'strapi::logger',
  'strapi::query',
  'strapi::body',
  'strapi::favicon',
  // 'strapi::session',
  'strapi::public',
];
// 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: {},
      },
    },
  },
})

But on upload I do get an error message like this:

This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
{
  message: "Invalid Signature 1ca6c8a6425504aa8abdf2a42f4d46a38ab1700f. String to sign - 'public_id=hochstrahlbrunnen_blau_nacht_e53aa63c8b&timestamp=1643655469'.",
  name: 'Error',
  http_code: 401
}

There are quite some reports out there mentioning this particular problem, but none comes with a solution that helps. So i wonder: What do I have to do to get rid of the problem?

Nobody having any problems?

I get a 401 when trying upload from locahost, and a 503, when trying to upload from heroku to cloudinary.
For localhost I use an env file, and on Heroku, all envs have been defined int he respective “settings” area.

Is there anything else I have to do?

401 means no permission. 503 means server timed out.

I would test a local upload if that works fine for a test then you know the it’s a cloudinary server error.
So make sure the key and things you are passing is getting passed

Thanks for your feedback. A “normal” upload to my Cloudinary account (not via Strapi) works fine.
401 is, what gets returned, when uploading from my localhost Strapi installation, and 503, when uploading from heroku, as mentioned. All that with Strapi 4.0.5 and 4.0.6.

Does your Strapi 4 version work with the cloudinary provider plugin. @Eventyret ?

I deleted my old account and opened a new one on Strapi. The new credentials work fine now. I obviousely must have copied over some wrong credentails.
@Eventyret thanks again for your feedback!

I’m not using V4 at work using V3.

Personal project I’m using V4 but not cloudinary but AWS

Glad you got it working @rowild