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

Changes to @aws-sdk/signature-v4-multi-region used by S3 MRAP and EventBridge #5229

Open
kuhe opened this issue Sep 18, 2023 · 6 comments
Open
Labels
announcement This is an announcement issue

Comments

@kuhe
Copy link
Contributor

kuhe commented Sep 18, 2023

Announcement

In an upcoming release for the AWS SDK for JavaScript v3, version TBD, the usage of the @aws-sdk/signature-v4-crt package will change.

*** this has been merged will be released on Oct 26, 2023.

See PR: #5225

Who is affected?

Users of @aws-sdk/signature-v4-crt. This is an optional package used by the S3 MRAP feature and EventBridge clients.
https://www.npmjs.com/package/@aws-sdk/signature-v4-crt

What is changing and why?

Currently, this package is imported dynamically by SDK code calling the Node.js require global function.
Because this is disruptive to bundlers both in the browser and server-side, and because it is difficult to analyze statically, the dynamic import is being removed.

Users will need to make an explicit call or import statement to register the functionality of the optional package. Instructions from the PR are duplicated here:

Code example (ESM):

import "@aws-sdk/signature-v4-crt"; // this import is now required to access multi-region signing

import { S3 } from "@aws-sdk/client-s3";

const client = new S3({});

const command = {
  Bucket: "arn:aws:s3::<ID>:accesspoint/<MY_MRAP_ID>.mrap",
  Key: "Example Key",
  Body: "Example Body",
};

await client.putObject(command);

Code example (CJS):

require("@aws-sdk/signature-v4-crt"); // this import is now required to access multi-region signing

const { S3 } = require("@aws-sdk/client-s3");

const client = new S3({});

const command = {
  Bucket: "arn:aws:s3::<ID>:accesspoint/<MY_MRAP_ID>.mrap",
  Key: "Example Key",
  Body: "Example Body",
};

await client.putObject(command);

You can make this change to your code in any SDK version, ahead of time, to prepare for the change.

After it is released, an error will be thrown if the import is missing. It will say:

Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly.
You must also register the package by calling [require("@aws-sdk/signature-v4-crt");]
or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";].
For more information please go to
https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt"

and the docs in our readme will be updated to the same.

@kuhe kuhe added feature-request New feature or enhancement. May require GitHub community feedback. needs-triage This issue or PR still needs to be triaged. announcement This is an announcement issue and removed feature-request New feature or enhancement. May require GitHub community feedback. needs-triage This issue or PR still needs to be triaged. labels Sep 18, 2023
@kuhe kuhe pinned this issue Sep 18, 2023
@kuhe
Copy link
Contributor Author

kuhe commented Sep 25, 2023

September 25th, 2023: a warning is now emitted when the @aws-sdk/signature-v4-crt package is loaded dynamically by the SDK when executing an operation that requires it. The warning instructs the user to explicitly import the package instead.

This warning will become an error going forward from the date the announced change is finalized.

@kuhe kuhe mentioned this issue Oct 2, 2023
3 tasks
@kuhe
Copy link
Contributor Author

kuhe commented Oct 12, 2023

We're expecting to finalize this change on or soon after October 25, 2023.

@rjmackay
Copy link

Could this be added to the documentation?
Ideally at least in the readme for the eventbridge client and the eventbridge docs (https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-global-endpoints.html#eb-ge-sdk-update). It's mentioned very briefly there, but nothing actually explains how you have to import this.

@kuhe
Copy link
Contributor Author

kuhe commented Oct 26, 2023

This change has been merged and will be in the next release.

@kuhe kuhe changed the title Upcoming changes to @aws-sdk/signature-v4-multi-region used by S3 MRAP and EventBridge Changes to @aws-sdk/signature-v4-multi-region used by S3 MRAP and EventBridge Oct 26, 2023
@kuhe kuhe unpinned this issue Dec 21, 2023
@jhuamanchumo
Copy link

Is it posible to use an MRAP endpoint with amplify-js?

Amplify.configure({
  Storage: {
    S3: {
      bucket: 'arn:aws:s3::<Account-ID>:accesspoint/<MY_MRAP_ID>.mrap)', 
      region: 'us-east-1' 
    }
  }
});

https://docs.amplify.aws/javascript/tools/libraries/configure-categories/#storage-amazon-s3

@kuhe
Copy link
Contributor Author

kuhe commented Jan 18, 2024

aws-crt is currently not available in the browser, so I do not expect MRAP to work in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
announcement This is an announcement issue
Projects
None yet
Development

No branches or pull requests

3 participants