Polyfill errors with legacy cloudinary object

lukiester
lukiester Member Posts: 4

Hello!

Having major problems since updating a few npm packages and nodeJS. This was my previous working code:

import { Cloudinary } from "@cloudinary/url-gen";
require('dotenv').config();

const cloudinary = require('cloudinary/lib-es5/cloudinary');

cloudinary.config({    cloud_name: 'BLABLA',    api_key: process.env.REACT_APP_CLOUDINARY_API_KEY,    api_secret: process.env.REACT_APP_CLOUDINARY_SECRET_KEY,    secure: true});

export const cld =  new Cloudinary({    cloud: {    cloudName: 'BLABLA',    api_key: process.env.REACT_APP_CLOUDINARY_API_KEY,    api_secret: process.env.REACT_APP_CLOUDINARY_SECRET_KEY,    secure: true    }});

export default cloudinary;

I was always a bit confused as to why I had to use both objects but basically it was the only way I could find to use cloudinary.utils.api_sign_request and cloudinary.uploader for deleting posts which i cant seem to do with the more recent cld.

Anyway when I now try to use the cloudinary object i get heaps and heaps of webpack errors saying certain things haven't been defined eg: process, path, os, crypto, url, buffer, etc - even when i installed all of these and used craco to fix the errors there was just more errors and it just seemed really messy. As i noticed all of this goes away when i dont use the legacy cloudinary object I thought there must be a better solution than installing all of these packages but also allowing cloudinary.utils.api_sign_request and cloudinary.uploader which i cant seem to use with the new object.

Thank you !