Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

245
Views
Error 500 al intentar subir a AWS S3 con multer-s3

Estoy usando express + multer-S3 para cargar archivos en AWS S3. Usando el siguiente código, obtengo un error de servidor interno 500 y no entiendo qué estoy haciendo mal.

 const aws = require("aws-sdk"); console.log("Require AWS"); const multer = require("multer"); const multerS3 = require("multer-s3"); const s3 = new aws.S3(); aws.config.update({ secretAccessKey: process.env.S3_ACCESS_SECRET, accessKeyId: process.env.S3_ACCESS_KEY, region: "eu-west-3", }); const fileFilter = (req, file, cb) => { if (file.mimetype === "image/jpeg" || file.mimetype === "image/png") { cb(null, true); } else { cb(new Error("Invalid file type, only JPEG and PNG is allowed!"), false); } }; const upload = multer({ fileFilter, storage: multerS3({ acl: "public-read", s3: s3, bucket: "schubox", contentType: multerS3.AUTO_CONTENT_TYPE, metadata: function (req, file, cb) { console.log("Called when saving image to AWS"); cb(null, { fieldName: "TESTING_METADATA" }); }, key: function (req, file, cb) { console.log("FILE ==> " + JSON.stringify(file)); cb(null, Date.now().toString()); }, }), });

Y en mi ruta

 router .route("/rayons") .get(auth, ctrlRayons.rayonsListe) .post(auth, **upload.single("fichier")**, ctrlRayons.rayonsCreerUn);

me sale este error

Credenciales faltantes en la configuración, si usa AWS_CONFIG_FILE, establezca AWS_SDK_LOAD_CONFIG=1"

Error: conecte EHOSTDOWN 169.254.169.254:80 - Local (192.168.1.10:56879) en internalConnect (net.js:934:16) en defaultTriggerAsyncIdScope (internal/async_hooks.js:452:18) en net.js:1022:9 en processTicksAndRejections (interno/proceso/task_queues.js:77:11)

¿Qué estoy haciendo mal? Mi cuenta de AWS S3 está bien, tengo mi ID y mi secreto bien, pero no hay nada escrito en mi depósito. Todos los tutoriales muestran el mismo procedimiento que el que yo uso.

De nuevo, gracias por tu ayuda.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!