In a docker container, the scality/s3server
-image is running. I am connecting to it with NodeJS using the @aws-sdk/client-s3
API.
const s3Client = new S3Client({
region: undefined, // See comment below
endpoint: 'http://127.0.0.1:8000',
credentials: {
accessKeyId: 'accessKey1',
secretAccessKey: 'verySecretKey1',
},
})
Region undefined
: this answer to a similar question mentions to leave the region out, but, accessing the region with await s3Client.config.region()
still displays eu-central-1
, which was the value I passed to the constructor in a previous version. Although I changed it to undefined
, it does still take the old configuration. Could that be connected to the issue?
It was possible to successfully create a bucket (test
) and it could be listed by running a ListBucketsCommand
(await s3Client.send(new ListBucketsCommand({}))
).
However, as mentionned in the title, uploading content or streams to the Bucket with
bucketParams = {
Bucket: 'test',
Key: 'test.txt',
Body: 'Test Content',
}
await s3Client.send(new PutObjectCommand(bucketParams))
does not work, instead I am getting a DNS resolution error (which seems odd, since I manually typed the IP-address, not localhost
.
Anyway, here the error message:
Error: getaddrinfo EAI_AGAIN test.127.0.0.1
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:72:26) {
errno: -3001,
code: 'EAI_AGAIN',
syscall: 'getaddrinfo',
hostname: 'test.127.0.0.1',
'$metadata': { attempts: 1, totalRetryDelay: 0 }
}
For the second question, I found a workaround:
Instead of specifying the IP-Address directly, using endpoint: http://localhost:8000
(so using the Hostname instead of the IP-Adress) fixes the DNS lookup exception. However, there is no obvious reason on why this should happen.