We are currently working on upgrading AWS SDK version from 2 to 3, and during the process we have encountered the issue where NodeHttpHandler fails to Authenticate the HTTPRequest, SignedV4 Request and throws the Forbidden 403 error.
We use Amazon OpenSearch Service 7.1, and AWS SDK 3 version, are they supported versions? Where can I find the relevant documentation ?
Also, any idea about the 403 Forbidden error would help, thanks!
code used:
let request = new HttpRequest({
method: method,
protocol: 'https',
hostname: endPoint,
port: 443,
path: requestPath,
query: '',
headers: {
host: endPoint,
'Content-Type': 'application/json',
},
body: body,
});
let response ={};
try {
const accessKey= me.env[ ${prefix}_ACCESS_KEY_ID
]
const secretAcess=me.env[${prefix}_SECRET_ACCESS_KEY
]
let credentialsFromPreix={
accessKeyId: accessKey,
secretAccessKey: secretAcess
}
const signer = new SignatureV4({
credentials: credentialsFromPreix,
region: region,
service: 'es',
sha256: Sha256,
});
const signedRequest = await signer.sign(request);
const client = new NodeHttpHandler();
const { response } = await client.handle(signedRequestChanged);
Error Received:
2023-11-06T15:54:02.943Z 8fe69aca-365a-4458-b040-3addde260e0b INFO esresponse Data:HttpResponse {
statusCode: 403,
reason: 'Forbidden',
headers: {
date: 'Mon, 06 Nov 2023 15:54:02 GMT',
'content-type': 'application/json',
'content-length': '861',
connection: 'keep-alive',
'x-amzn-requestid': '2368ab7a-57be-448d-adcf-a6ce24483b45',
'access-control-allow-origin': '*'
},