Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The requested module '@aws-sdk/client-sts' does not provide an export named 'AssumeRoleCommand' #5692

Closed
3 tasks done
jurijzahn8019 opened this issue Jan 19, 2024 · 3 comments
Assignees
Labels
bug This issue is a bug. closing-soon This issue will automatically close in 4 days unless further comments are made. p1 This is a high priority issue pending-release This issue will be fixed by an approved PR that hasn't been released yet.

Comments

@jurijzahn8019
Copy link

Checkboxes for prior research

Describe the bug

Since 495 the import from client sts is broken

Due to the fact, that package.json is missing exports field
The library always load cjs code instead of esm

And this cjs code is now somehow broken

SDK version number

@aws-sdk/client-sts@3.495.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v20.9.0

Reproduction Steps

Create file foo.mjs with contents

import { AssumeRoleCommand } from "@aws-sdk/client-sts";

node ./foo.mjs

Observed Behavior

import { Credentials, STSClient, STSClientConfig, AssumeRoleCommand } from "@aws-sdk/client-sts";
^

SyntaxError: The requested module '@aws-sdk/client-sts' does not provide an export named 'AssumeRoleCommand'

Expected Behavior

Should work as <= 3.494.0

Possible Solution

Ideally add export field to the package.json like

"exports": {
  "types": "./dist-types/index.d.ts",
  "import": "./dist-es/index.js",
  "require": "./dist-cjs/index.js"
}

Additional Information/Context

No response

@jurijzahn8019 jurijzahn8019 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 19, 2024
@kuhe kuhe added p1 This is a high priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Jan 19, 2024
@kuhe kuhe self-assigned this Jan 19, 2024
@kuhe kuhe added the queued This issues is on the AWS team's backlog label Jan 19, 2024
@kuhe
Copy link
Contributor

kuhe commented Jan 19, 2024

Hi, sorry, this was my mistake. The dist-cjs or commonjs exports of our packages are intended to be ESM compatible.

To ensure this, the commonjs code must have form of annotation, in this case

module.exports = {
  ...,
  AssumeRoleCommand,
  ...
};

A recent change to the export format to use esbuild lost some of these annotations, making the ESM loader unable to identify that the package does indeed export AssumeRoleCommand.

We will release a fix for this today. If you continue to use this version, the workaround is to use an import object.

import sts from "@aws-sdk/client-sts";

const { AssumeRoleCommand } = sts;

@kuhe kuhe added pending-release This issue will be fixed by an approved PR that hasn't been released yet. and removed queued This issues is on the AWS team's backlog labels Jan 19, 2024
@kuhe
Copy link
Contributor

kuhe commented Jan 19, 2024

A fix for this was released in https://www.npmjs.com/package/@aws-sdk/client-sts/v/3.496.0.

@kuhe kuhe added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Jan 19, 2024
Copy link

github-actions bot commented Feb 3, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug. closing-soon This issue will automatically close in 4 days unless further comments are made. p1 This is a high priority issue pending-release This issue will be fixed by an approved PR that hasn't been released yet.
Projects
None yet
Development

No branches or pull requests

2 participants