'can't connect on minio with node js
- i tried to connect on minio with node js using minioClient
- this is my code
Minio.js
const Minio = require('minio')
const minioClient = new Minio.Client({
endPoint: 'xxxxxx',
port: 9000,
useSSL: true,
accessKey: 'xxxxxx',
secretKey: 'xxxx'
});
module.exports = minioClient
fileupload.js
const minioClient = require('../config/connection/Minio')
module.exports = minioUpload = {
upload: async(req, res) => {
if (req.file) {
var metaData = {
'Content-Type': 'application/octet-stream',
'X-Amz-Meta-Testing': 1234,
'example': 5678
}
var originalname = req.file.originalname.split(' ');
const fileName = originalname.join('_');
try {
// Using fPutObject API upload your file to the bucket maztou.
minioClient.putObject('maztou', fileName, req.file.buffer, metaData, function(err, etag) {
if (err) return console.log(err)
return res.status(201).json('File uploaded successfully.', fileName)
});
} catch (err) {
console.log(err, '<== ERROR');
}
}
}
}
router.js
const express = require('express')
const minioUpload = require('../controllers/fileupload')
const router = express.Router()
const multer = require('multer')
router.route('/uploads').post(multer({ storage: multer.memoryStorage() }).single("file"), minioUpload.upload)
module.exports = router
And the server return this :
Error: connect ETIMEDOUT XXXX:9000
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
errno: -60,
code: 'ETIMEDOUT',
syscall: 'connect',
address: 'XXXX',
port: 9000
}
Can some one help me for this issus, i'have already read all the documentation about minioClient , all my setup is good, and i have. this issus !
Solution 1:[1]
The timeout indicates that the client cannot connect to the server. You should check if the endpoint, port and credentials passed to MinIO client are correct and turn off useSSL if TLS is not enabled. If your MinIO server is running in docker, you may want to check if the port is exposed.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tyler2P |
