Closed Cristian-Pixtig closed 10 months ago
Issue is still present in version @aws-sdk/client-cloudfront-keyvaluestore v3.470.0
Hi @Cristian-Pixtig @Arno-Z - thanks for reporting. I was able to reproduce this and doing more investigation as well as reaching out to the service team for their insight. I'll circle back as soon as I get updates. Appreciate your patience.
Thanks for your patience. @Cristian-Pixtig @Arno-Z
After further investigation, I found out that JS v3 is opt-in for the use of Sigv4a due to a large optional dependency on the aws-crt
node bindings package. It doesn't automatically include nor dynamically import this package due to its size negatively affecting customer who don't need it.
Another thing worth mentioning, according to the Service API docs, is that if you intend to obtain a reference to a key value store, service API suggests to use DescribeKeyValueStoreCommand
from the CloudFront KeyValueStore API
instead of CloudFront API
. Two APIs return slightly different data as mentioned below:
Both the CloudFront API and the CloudFront KeyValueStore API have a describe operation that returns data about the key value store:
- The CloudFront API provides data such as the status and the date that the store itself was last modified.
- The CloudFront KeyValueStore API provides data about the contents of the storage resource — the key value pairs in the store, and the size of the contents.
The describe operations in the two APIs return slightly different data that identifies the key value store:
- The describe operation in the CloudFront API returns an ETag, the UUID, and the ARN of the key value store.
- The describe operation in the CloudFront KeyValueStore API returns an ETag and the ARN of the key value store.
Finally, here's the code that I modified, tested and worked as expected:
import { CloudFrontKeyValueStoreClient, PutKeyCommand, DescribeKeyValueStoreCommand } from "@aws-sdk/client-cloudfront-keyvaluestore";
// *** add these two imports: ***
import { SignatureV4MultiRegion } from "@aws-sdk/signature-v4-multi-region";
import "@aws-sdk/signature-v4-crt";
const client = new CloudFrontKeyValueStoreClient({
region: "us-west-2",
signerConstructor: SignatureV4MultiRegion, // *** add this parameter. ***
});
const describeInput = {
KvsARN: "arn:aws:cloudfront::xxxxxxxx:key-value-store/xxxxxxx",
}
const commandDescribe = new DescribeKeyValueStoreCommand(describeInput);
const responseDescribe = await client.send(commandDescribe);
const input = {
Key: 'newkey',
Value: "newkeyvalue",
KvsARN: responseDescribe.KvsARN,
IfMatch: responseDescribe.ETag
};
const command = new PutKeyCommand(input);
const responsePut = await client.send(command);
Hope that makes sense and let me know if you have any further questions! John
Thank you very much, I tested the configuration on the client you provided, the error no longer appears @aBurmeseDev
This affects .NET as well.
The class AmazonCloudFrontKeyValueStoreConfig does not have a method SignerConstructor so unsure how to proceed.
Any help appreciated.
```
BasicAWSCredentials creds = new BasicAWSCredentials(aws_access_key, aws_secret_key); AmazonCloudFrontKeyValueStoreConfig config = new(); config.SignatureVersion = "v4"; config.RegionEndpoint = RegionEndpoint.USWest1; //config.UseSignatureVersion4 = true;
AmazonCloudFrontKeyValueStoreClient kvs = new(creds, config);
ListKeysRequest request = new()
{
KvsARN = kvarn,
MaxResults = 10
};
try
{
var result = await kvs.ListKeysAsync(request);
}
catch (Exception ex)
{
var msg = ex.Message; //Gives Credential should be scoped to a valid region.
}
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.
Describe the bug
I'm trying to use the library @aws-sdk/client-cloudfront-keyvaluestore but I am getting the following error:
code:
It also does not allow me to describe keyvaluestore, but using the library @aws-sdk/client-cloudfront it does allow me to access the description of the space, this last library does not allow me to add a key to the space so I need to use the first library
Expected Behavior
Key creation in space
Current Behavior
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
SDK version used
@aws-sdk/client-cloudfront-keyvaluestore@3.468.0
Environment details (OS name and version, etc.)
x86_64 -> Lambda -> Node.js 18.x