Skip to main content

not getting the url or secureUrl in the response from the cloudinary

Comments

1 comment

  • Wissam Khalili

    Hi Ankit,

    Here are a few things you could check:

    Ensure that the file.stream() is correctly providing a stream of data. You might want to log the stream data to see if it's correctly formed.

    The upload_stream function is asynchronous, so it's recommended to wrap it in a promise. Make sure you're correctly handling the promise and any potential errors.

    Check the result object returned by the upload_stream function. The secure_url should be a property of this object. If it's not present, there might be an issue with the upload itself.

    Make sure that your Cloudinary setup (like cloud_name, api_key, and api_secret) is correctly configured.

    You can find some code examples here:

    https://cloudinary.com/blog/guest_post/media-uploads-with-cloudinarys-upload-functions#upload_stream

    https://cloudinary.com/documentation/node_image_and_video_upload#node_js_upload_stream

    Here is another example :

    // Stream upload
    var upload_stream = cloudinary.uploader.upload_stream({ tags: 'basic_sample' }, function (err, image) {
      console.log();
      console.log("** Stream Upload");
      if (err) { console.warn(err); }
      console.log("* Same image, uploaded via stream");
      console.log("* " + image.public_id);
      console.log("* " + image.url);
      waitForAllUploads("pizza3", err, image);
    });
    fs.createReadStream('pizza.jpg').pipe(upload_stream);

    I hope you find it useful.

    Regards,

    Wissam

     

    0

Post is closed for comments.