Hello, i'm just trying to list my s3 buckets on node red, and I wrote a simple node js application:
var AWS = global.get('aws-sdk');
var ep = new AWS.Endpoint('http://localhost:4566');
var s3 = new AWS.S3({endpoint:ep});
s3.listBuckets(function(err,data){
if(err) console.log(err,err.stack);
else console.log(data.Buckets);
});
It works when i run node app.js
siply from bash, but If i try to run it on a function node in node-red, I get this error:
Error: connect ECONNREFUSED 169.254.169.254:80
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16) {
message: 'Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1',
errno: -111,
code: 'CredentialsError',
syscall: 'connect',
address: '169.254.169.254',
port: 80,
time: 2022-07-11T11:52:37.421Z,
originalError: {
message: 'Could not load credentials from any providers',
errno: -111,
code: 'CredentialsError',
syscall: 'connect',
address: '169.254.169.254',
port: 80,
time: 2022-07-11T11:52:37.421Z,
originalError: {
message: 'EC2 Metadata roleName request returned error',
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '169.254.169.254',
port: 80,
time: 2022-07-11T11:52:37.420Z,
originalError: [Object]
}
}
} Error: connect ECONNREFUSED 169.254.169.254:80
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16)
I tried debugging it and the endpoint looks correctly configured. I should mention I'm running both node-red and localstack through docker, and they are connected to the same docker network.