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

244
Vistas
Node S3Client Error - input.useDualstackEndpoint is not a function

I'm trying to get a list of files within an S3 folder in a lambda written in typescript. I've added the following dependencies to my package.json.

"@aws-sdk/client-s3": "^3.41.0",
"@aws-sdk/node-http-handler": "^3.40.0",

I then use the S3 client like this:

const client = new S3Client({
    maxAttempts: 3,
    retryMode: 'STANDARD',
    region: getAwsRegion(),
    requestHandler: new NodeHttpHandler({
      connectionTimeout: 3000, // Timeout requests after 3 seconds
      socketTimeout: 5000, // Close socket after 5 seconds
    }),
    credentials: args.credentials,
  });


  const listObjectsCommand = new ListObjectsCommand({
    Bucket: args.bucketName,
    Delimiter: '/',
    Prefix: pathToPartition,
  });
  const objects = await client.send(listObjectsCommand);

I've tried using ListObjectsV2Command as well, but it has the same error. The error is:

TypeError: input.useDualstackEndpoint is not a function\n at Object.getEndpointFromRegion (/var/task/node_modules/<my_module>/node_modules/@aws-sdk/config-resolver/dist-cjs/endpointsConfig/utils/getEndpointFromRegion.js:12:46)\n at processTicksAndRejections (internal/process/task_queues.js:95:5)\n at async Object.serializeAws_restXmlListObjectsCommand (/var/task/node_modules/<my_module>/node_modules/@aws-sdk/client-s3/dist/cjs/protocols/Aws_restXml.js:2386:68)\n at async /var/task/node_modules/<my_module>/node_modules/@aws-sdk/middleware-serde/dist-cjs/serializerMiddleware.js:5:21 .

Any idea what I may be doing wrong?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

This happened due to a mismatch is the aws-sdk version used in the package.json I had and the package.json of a dependency. Updating it to be the same version fixed this!

about 4 years ago · Juan Pablo Isaza Denunciar

0

Here is a working minimal version of your function. Get this simple version working first and incrementally add complexity.

AWS_REGION is a lambda-provided env var. I defined the BUCKET env var. You can pass the bucket name with the event payload (or, to begin with, hard-code it to minimise sources of error).

import { S3Client, ListObjectsCommand} from '@aws-sdk/client-s3';

const client = new S3Client({ region: process.env.AWS_REGION });
const bucket = process.env.BUCKET;

export async function handler(): Promise<void> {
  const cmd = new ListObjectsCommand({
    Bucket: bucket
  });

  const objects = await client.send(cmd);

  console.log(objects)
}
about 4 years ago · Juan Pablo Isaza 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