cloudinary / cloudinary_npm

Cloudinary NPM for node.js integration
629 stars 323 forks source link

mp3 file is not being deleted #658

Closed ritikRidingad closed 7 months ago

ritikRidingad commented 7 months ago

Bug report for Cloudinary NPM SDK

Before proceeding, please update to latest version and test if the issue persists

Describe the bug in a sentence or two.

mp3 file is not being deleted after sending the correct public_id and after hiting the api am getting { result: 'not found'} in my cosnole while my file is still exists in cloudinary


 const song = await Song.findById(req.params.id)
        if (song.songs.public_id && song.songs.url) {
            cloudinary.v2.uploader.destroy(song.songs.public_id)
                .then(deleted => {
                    console.log('deleted', deleted);
                })
                .catch(error => {
                    console.error('error', error);
                });
        }

Issue Type (Can be multiple)

[ ] Build - Can’t install or import the SDK [ ] Babel - Babel errors or cross browser issues [ ] Performance - Performance issues [ ] Behaviour - Functions aren’t working as expected (Such as generate URL) [ ] Documentation - Inconsistency between the docs and behaviour [ ] Incorrect Types - For typescript users who are having problems with our d.ts files [ ] Other (Specify)

Steps to reproduce

… if applicable

Error screenshots

… if applicable

Browsers (if issue relates to UI, else ignore)

[ ] Chrome [ ] Firefox [ ] Safari [ ] Other (Specify) [ ] All

Versions and Libraries (fill in the version numbers)

Cloudinary_NPM SDK version Node - 0.0.0 NPM - 0.0.0

Config Files (Please paste the following files if possible)

Package.json

Repository

If possible, please provide a link to a reproducible repository that showcases the problem

Vdeub-cloudinary commented 7 months ago

Hi @ritikRidingad, Audio files are of video types as documented here so you need to add the resource_type parameter and set it to video in your destroy call.