Unable to connect to S3 bucket with Session token

I stored test data file in S3 bucket and tried to access uding s3client.
I used AWS JSLib for K6 to configure and connect to S3 client. It could not find bucket in a SSO enabled AWS account which requires AWS_SESSION_TOKEN.
The AWS Config doesn’t have a provision to pass Session Token alongwith Access_Key_ID and Secret_Access_Key which is mandatory for SSO enabled accounts.

Here is my script to access a bucket.

export default function verifyBucket(){
let testBucketName ="mybucket";
    
    try{
    const s3 = new S3Client(awsConfig);
    } catch (err){
      console.error(err)
    } finally {
      console.log("s3 client creation check finished.")
    }

    const buckets = s3.listBuckets();

    console.log("first bucket:"+buckets[0])
    console.log("bucket count:"+buckets.length)
  
    if (buckets.filter((bucket) => bucket.name === testBucketName).length == 0) {
      exec.test.abort();
    } else {
        console.log("bucket found")
    }
  }

Output I get:

INFO[0001] s3 client creation check finished.            source=console
INFO[0002] first bucket:undefined                        source=console
INFO[0002] bucket count:0                                source=console

image
Need to send all three parameters for connection.

Is there any way I can pass the session Token?

Hi @sumitbhowmick

Unfortunately, the AWS jslib doesn’t handle authentication AWS_SESSION_TOKEN yet. I don’t have an Estimated Time of Arrival on this, but it’s now tracked in as a GitHub issue in the repository, and I’ll let you know as soon as we prioritize and start work on this.

Note, that if you have the time and resources to work on this yourself, we would really appreciate your contribution, and I’d be happy to support and review your work.

Please let me know if that was helpful, and if I can help you in any other way meanwhile :bowing_man:

Hi @oleiade,

Thanks for putting it in queue.
We need this rather quickly as it is basic for running our tests.

I can try to spend some time to collaborate with you if it helps to get a resolution sooner. I would appreciate your support on this to understand what has been done and what else needs to be done to support this parameter.

Let me know if you would like to connect sometime. DM me please.

Hey @sumitbhowmick

I appreciate your understanding and willingness to support. We are going to prototype some solution to evaluate the time needed for a full implementation in the upcoming days, depending on that, we would probably schedule support for this feature for k6’s next release (at the end of October if I’m not mistaken).

I’ll get back in touch with you directly once I know more, and have an idea of the kind of support/cooperation we could offer each other to get this done as quick as possible.

:bowing_man: