AWS Cognito create user at setup, perform test in the main scenario

Hello everyone,

I am new on load testing and I am struggling with an issue.

I am trying to implement a user creation on the setup method with K6, around 100 users.

After that, in the main scenario, I want them to login in. The problem here is that, when I try to require the appropriate modules (like aws-sdk etc.) problems like regeneratorRuntime appear or it says that my file(aws-sdk) could not be found on the disk and it tries to fetch it from the web.

Is there any good practice on how to achieve what I want? Any code snippet?

Thank you in advance!

Hi,

I suppose you just need the signature part?
So maybe trying this will help you.

Aws-sdk is quite big and k6 will need to have a copy of it for each VU as it runs completely separate VM for each of them. So preferably you should try to use … smaller amounts of js code :wink:

Hello,

Thank you for the quick response.

I do not need just the signature, but I need the whole aws-sdk which will retrieve first the userPoolId and then create user by adminCreateUser method of AWSCognito.

Any ideas about that?

Thanks in advance.

I played a little bit with browserify and apparently it somewhat works with the latest version v2.431.0 if I browserify ./lib/aws.js directly and then import it.

Depending on what I call I get … errors which probably can be fixed, but I get different errors depending on what I call so I probably can’t fix all of them … at least not fast enough.
Can you link me your script and maybe the aws.js you are running - possibly uploading them to a github repo and I will see how many errors I can fix. You can also try to require https://github.com/facebook/regenerator/tree/master/packages/regenerator-runtime in the aws.js file (you will have to edit it sorry) but I don’t know how much that will help.
This might resolve itself by updating babel in k6 but I am not certain how long this will take me :frowning:
Again even this js file is nearly 7mb … given that we need a copy of it in each VU and it needs to be a compiled copy I have no idea how much memory per VU will this take but my fast test says something like 10-12mb per VU just for script that loads it and prints a line not actually doing anything useful

I have to use aws-sdk in tests also, and have other error when run tests with browserified lib

“ERRO[0001] TypeError: Object has no member ‘setPrototypeOf’ at .”.libs/aws.js:188016:22(347)"

  1. Could you tell me what could be a problem? I see the same error when try import cheerio lib from manual example

  2. Also, I tried to import aws-sdk javascript library (not npm lib) but without success.
    In logs, I see that aws object properties are undefined
    Can sdk-for-browser version be used without browserify in k6?