Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

437
Vistas
Error: Missing credentials in config - /nodeapp/node_modules/aws-sdk/lib/request.js:31

I'm pulling objects using s3.listObjects() function from the AWS-SDK and I keep getting the following error:

/nodeapp/node_modules/aws-sdk/lib/request.js:31 

Followed by

Error: Missing credentials in config
at IncomingMessage.<anonymous> (/nodeapp/node_modules/aws-sdk/lib/util.js:863:34)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:186:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)

This doesn't add up because I have a different route (downloadParam) that retrieves an object from S3 without giving me this error. Additionally, when I log out the objects retrieved from downloadResults route, it appears the objects were retrieved with no issues but i'll still get this error.

I have spent hours on this issue and I can't seem to figure out why this is occurring. I have pasted by code for both routes below, the one that works and the one that doesn't. From what I've gleaned online, this appears to be more of a code issue than an AWS-SDK credentials issue.

  downloadParam: function(app, s3){
app.use('/api', apiRoutes)

apiRoutes.get('/download-param-file', function(req, res, next){
 res.set({'Content-Type':'text/csv'})
  s3.getObject({Bucket: 'some-bucket', Key: 'some-key' + req.query.fileName}, function(err, file){

    if (err) {
      console.log(err);
      return next(err);
    } else {
      return res.send(file.Body.toString());
    }
  })
})
},

downloadResults: function(app, s3){
app.use('/api', apiRoutes)

apiRoutes.get('/download-results-file', function(req, res, next){
   res.set({'Content-type': 'application/zip'})

   var params = {
    Bucket: 'some-bucket',
    Delimiter: '/',
    Prefix: 'some-key'
    };


   var filesArray = []
   var files = s3.listObjects(params).createReadStream()
   var xml = new XmlStream(files)
   xml.collect('Key')

   xml.on('endElement: Key', function(item) {
     filesArray.push(item['$text'].substr(params.Prefix.length))
    })

   xml.on('end', function() {

    res.send(zip(filesArray, req.query.jobName,  params))


  })        
})
}

As of right now downloadParams works as expected but downloadResults does not. Any help would be tremendously appreciated.

This link seems solve an issue similar to mine

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You're not authenticating the call. The bucket does not have permissions to list objects without authentication, whereas it does have permission to download specific files without authentication.

See the Amazon Documentation on adding credentials safely to the instance.

Essentially,

var creds = AWS.Credentials();
creds.accessKeyId = 'AKIAIOSFODNN7EXAMPLE';
creds.secretAccessKey = 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY';

AWS.config.credentials = creds;
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda