facing the error of SOCKET connection Timeout

Options
Ashutosh1114
Ashutosh1114 Member Posts: 1

im trying to upload a local disk image to cloudinary by using multer(upload) as a middleware.

code

const uploadOnCloudinary = async (localFilePath) => {

    try {

        if (!localFilePath) return null

        //upload the file on cloudinary

        const response = await cloudinary.uploader.upload(localFilePath, {

            resource_type: "auto"

        })

        // file has been uploaded successfull

        //console.log("file is uploaded on cloudinary ", response.url);

        fs.unlinkSync(localFilePath)

        return response;


    } catch (error) {

        console.error("error uploading",error);

        fs.unlinkSync(localFilePath) // remove the locally saved temporary file as the upload operation got failed

        return null;

    }

}

im getting this error: -

error: Error [ERR_SOCKET_CONNECTION_TIMEOUT]: Socket connection timeout

   at new NodeError (node:internal/errors:399:5)

   at internalConnectMultiple (node:net:1099:20)

   at Timeout.internalConnectMultipleTimeout (node:net:1638:3)

   at listOnTimeout (node:internal/timers:575:11)

   at process.processTimers (node:internal/timers:514:7) {

  code: 'ERR_SOCKET_CONNECTION_TIMEOUT'

 }

Answers

  • Tamara
    Tamara Member, Cloudinary Staff Posts: 97
    Options

    Hi @Ashutosh1114 ,

    The "ERR_SOCKET_CONNECTION_TIMEOUT" message most likely indicates an issue with the network connectivity of your application environment, or with a third-party issue such as a firewall, security system, VPN, or some other system that affects the ability of your application code to reach the internet.

    This won't be affected by the actual code you're using, and we won't see any such errors on our side (because the API calls never reached our servers).

    If you suspect that the connection issue is caused by some problem within our SDK code, please let us know how you tested that and how we can reproduce it, and we'll check it promptly.

    Please also include information about the application server's connection to api.cloudinary.com at the time the errors occurred (e.g a traceroute showing the connection, ping times, the IP address you received from a DNS lookup for api.cloudinary.com and from which DNS server, etc)

    Regards,

    Tamara