Himanshu Yadav
Himanshu Yadav

Reputation: 1

How to resolve MinIO connection issues when deploying on Render Cloud using Ngrok?

I'm working on the deployment of my backend app, which has been developed using Node/Express, MongoDB, and MinIO. During development, I used the MinIO connection locally without any issues. However, when deploying the app on Render Cloud, I encountered an error stating that the MinIO port does not have access to a public URL.

To resolve this, I used Ngrok to expose the local port to a public URL. While this worked partially, I started getting the following errors:

Error: connect ENETUNREACH 2600:1f1c:d8:5f00::6e:2:9000 - Local (:::0) Error: connect ETIMEDOUT 13.56.217.111:9000 Error: connect ENETUNREACH 2600:1f1c:d8:5f00::6e:0:9000 - Local (:::0)

Below is the relevant Ngrok session information and MinIO configuration:

 #ngrok - m my ngrok commands and the forwarded urls                                                                                                                                                                                     
                                                                                                                                                                                                             
 ❤️  ngrok? We're hiring https://ngrok.com/careers                                                                                                                                                            
                                                                                                                                                                                                             
 Session Status                online                                                                                                                                                                        
 Account                       [email protected] (Plan: Free)                                                                                                                                   
 Version                       3.19.1                                                                                                                                                                        
 Region                        India (in)                                                                                                                                                                    
 Latency                       290ms                                                                                                                                                                         
 Web Interface                 http://127.0.0.1:4040                                                                                                                                                         
 Forwarding                    https://d081-2409-40e3-5e-2bc0-bc90-7a48-347a-3471.ngrok-free.app -> http://localhost:9000                                                                                    
                                                                                                                                                                                                             
 Connections                   ttl     opn     rt1     rt5     p50     p90                                                                                                                                   
                               0       0       0.00    0.00    0.00    0.00                                                                                                                                  
                                                                              
 
 
 #minio.Confog.js - Minio configuration files
 
 const Minio = require("minio");
 const dotenv = require("dotenv");
 
 dotenv.config({ path: "./config.env" });
 
 const minioClient = new Minio.Client({
   endPoint: process.env.MINIO_ENDPOINT.replace("https://", "").replace("/", ""), 
   port: parseInt(process.env.MINIO_PORT, 10) || 443, 
   useSSL: true,
   accessKey: process.env.MINIO_ACCESS_KEY,
   secretKey: process.env.MINIO_SECRET_KEY,
 });
 
 const bucketName = process.env.MINIO_BUCKET;
 
 (async () => {
   try {
     const exists = await minioClient.bucketExists(bucketName);
     if (!exists) {
       await minioClient.makeBucket(bucketName, "");
       console.log(`Bucket '${bucketName}' created successfully.`);
     } else {
       console.log(`Bucket '${bucketName}' already exists.`);
     }
   } catch (err) {
     console.error("Error with MinIO bucket:", err);
   }
 })();
 
 module.exports = minioClient;
 
 
 
 
 # Environment Settings
 NODE_ENV=development
 PORT=3000
 
 # MinIO Configuration file
 MINIO_ENDPOINT=d081-2409-40e3-5e-2bc0-bc90-7a48-347a-3471.ngrok-free.app
 MINIO_PORT=443
 MINIO_ACCESS_KEY=himanshuyadav
 MINIO_SECRET_KEY=#Himan123
 MINIO_BUCKET=mx-healthcare

How can I resolve the ENETUNREACH and ETIMEDOUT errors when trying to connect MinIO using Ngrok in this deployment setup? Is using Ngrok for this purpose reliable, or are there better alternatives for exposing MinIO on Render Cloud?

Upvotes: 0

Views: 55

Answers (1)

One Lost Dev
One Lost Dev

Reputation: 1

ENETUNREACH is an error that indicates that the network is unreachable which in your case indicates that there might be issues with IPV6 connectivity.

ETIMEDOUT indicates that the connection attempt to the minIO server timed out maybe de to server issues, or network related problems.

make some adjustments to your ngrok configurations, like

  1. Use TCP tunneling instead of HTTP.

    ngrok tcp 9000

  2. Update your minIO configuration

    const minioClient = new Minio.Client({
          endPoint: '0.tcp.ngrok.io',
          port: 12345, // Use the port provided by Ngrok
          useSSL: false, // It is very very important to set this to false when using TCP tunneling
          accessKey: process.env.MINIO_ACCESS_KEY,
          secretKey: process.env.MINIO_SECRET_KEY,
        });

The above should sort your minIO ETIMEDOUT error.

  1. Try a persistent ngrok domain so your links can be consistent through all restarts. (It is available in paid plans btw...)

  2. Ngrok is designed for temporary tunneling, so i would also recommend that you use a Cloud based object storage service like VPS or a Kubernetes cluster. if you want, I can make research in that regard and then drop also.

I really hope you are able to sort your issues out though. Reach out if you have more concerns

Upvotes: 0

Related Questions