Strapi - Cloudinary image upload, Request Timeout error

karmawangchu
karmawangchu Member Posts: 1
edited January 8 in Developer APIs

When i Use Cloudinary with Strapi (using @strapi/provider-upload-cloudinary version 4.16.2 and Strapi v4.16.2 and Node 20.9.0 ) I am not able to upload Images. I get a Request Timeout error.

I tried playing with the timeout parameter on my side but it doesn't help. I get http: POST /upload (5478 ms) 500 status (similar 5000ms - 6000 ms every time) no matter what timeout value I put.

The screenshot below is the typical traceout I get:


This is the screenshot of what i see on Strapi:


I confirm I have all the configurations set up right under ./config/plugins.js and have correctly set up the required keys in .env file.

The following is my plugin.js file:



My .env file:

I was also able to upload few images (once a few days back and few more images the day before yesterday - so it seems to work sometimes but give the error most of the time.


If anyone could help. I scoured through Strapi forums without success.

Tagged:

Comments

  • Wissam
    Wissam Member, Cloudinary Staff Posts: 103

    Hi @karmawangchu ,

    I understand you're experiencing a timeout error when trying to upload images using Cloudinary with Strapi.

    Firstly, you can add the timeout parameter to your upload call to override the maximum amount of time to wait for a response from Cloudinary before the connection is terminated. This is done through the SDK. For example, in Node.js (v2), you can implement the following:

    cloudinary.v2.uploader.upload('my_image.jpg', {timeout:60000}, function(error,result){});
    

    Please note that the timeout parameter is currently only supported when using one of the SDKs. You can read more about the timeout parameter in the Upload API documentation.

    If timeouts still persist, it might be due to the size of the file you are uploading. If you're requesting an incoming transformation on a large file, this could increase the processing time and cause errors. In this case, you might want to consider making the transformation asynchronous by passing the 'Async' parameter set to true in your ImageUploadParams.

    I have checked the logs and it seems that the upload didn't get to our endpoint.

    I would recommend posting your question on the Strapi forum. The community there may be able to provide more specific guidance.

    Best Regards,

    Wissam