Strapi 4.11.5 not working with cloudinary

43 Views Asked by At

I followed this article to set up cloudinary with my strapi application, but it didn't work. Found an similar question in Stackoverflow here. Then I found out there was an issue with cloudinary here. Read and verified carefully, made several changes... But no matter what I did it always upload media to the public/uploads folder instead of cloudinary.

So I also open a bug in strapi here. But there is no response or answer from anyone. So, I ask a question here in a hope that someone can help me out.

Below is the information to reproduce the issue:

System infomration:

  • Node.js version: 18.16.1
  • NPM version: 8.3.1
  • JavaScript

package.json

"devDependencies": {},
    "dependencies": {
        "@strapi/plugin-i18n": "4.11.5",
        "@strapi/plugin-users-permissions": "4.11.5",
        "@strapi/provider-upload-cloudinary": "4.11.5",
        "@strapi/strapi": "4.11.5",
        "pg": "8.8.0"
    },

./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: {},
                uploadStream: {},
                delete: {},
            },
        },
    },
});

./config/middlewares.js

module.exports = [
    "strapi::errors",
    {
        name: "strapi::security",
        config: {
            contentSecurityPolicy: {
                useDefaults: true,
                directives: {
                    "connect-src": ["'self'", "https:"],
                    "img-src": ["'self'", "data:", "blob:", "res.cloudinary.com"],
                    "media-src": ["'self'", "data:", "blob:", "res.cloudinary.com"],
                    upgradeInsecureRequests: null,
                },
            },
        },
    },
  // ...
];

Configured roles and permissions in strapi dashboard properly and verified with Postman.

Everything seems work fine, no error, but images are always saved in the public/uploads folder instead of cloudinary. Am I missing something? Please help.

0

There are 0 best solutions below