Skip to content

@aws-sdk/client-s3 TypeError: A dynamic import callback was invoked without --experimental-vm-modules in jestΒ #7420

@H1Gdev

Description

@H1Gdev

Checkboxes for prior research

Describe the bug

When using the latest @aws-sdk/client-s3 with jest, the following error occurs.

    TypeError: A dynamic import callback was invoked without --experimental-vm-modules

    >  97 |         const s3Response = await s3.send(getObjectCommand);
          |                            ^

      at node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js:63:25
      at node_modules/@smithy/property-provider/dist-cjs/index.js:50:39
      at coalesceProvider (node_modules/@smithy/property-provider/dist-cjs/index.js:76:24)
      at node_modules/@smithy/property-provider/dist-cjs/index.js:95:24
      at node_modules/@smithy/core/dist-cjs/index.js:62:23
      at node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:90:20
      at node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js:33:22

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

Node.js 22

Reproduction Steps

          const s3 = tracer.captureAWSv3Client(new S3({}));
          const putObjectCommand = new PutObjectCommand({
            Bucket: url.hostname,
            Key: url.pathname.substring(1),
            Body: await fs.readFile(tmpFilePath),
          });
          const s3Response = await s3.send(putObjectCommand);

Observed Behavior

TypeError occurs...

Expected Behavior

No errors should occur.

Possible Solution

No response

Additional Information/Context

No response

Metadata

Metadata

Assignees

Labels

p3This is a minor priority issuethird-partyThis issue is related to third-party libraries or applications.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions