xk6-cognito 検証 -> エラー出て動きませんでした

k6 のモジュール xk6-cognito を検証してみたのですが、エラー出て動かなかった話をご紹介します。

k6 - load testing tool

tmieulet/xk6-cognito: An example module for https://k6.io/ to get a cognito access token using USER_SRP_AUTH flow.

xk6-cognito モジュールを利用する k6 の準備

go version  

go version go1.19.3 darwin/arm64
go install go.k6.io/xk6/cmd/xk6@latest
xk6 build master   --with github.com/tmieulet/xk6-cognito

xk6-cognito サンプルコード実行

結論: 動作しませんでした ❌

git clone [email protected]:tmieulet/xk6-cognito.git
./k6 run --vus 1 --duration 2s ~/works/xk6-cognito/examples/loadTest.js

          /      |‾‾| /‾‾/   /‾‾/   
     /  /       |  |/  /   /  /    
    /  /        |     (   /   ‾‾  
   /             |  |   |  (‾)  | 
  / __________   |__| __ _____/ .io

ERRO[0000] TypeError: could not convert function call parameter 0: could not convert eu-west-1 to context.Context
	at reflect.methodValueCall (native)
	at file:///Users/your_name/works/xk6-cognito/examples/auth-cognito.js:14:15(47)
	at go.k6.io/k6/js.(*InitContext).Require-fm (native)
	at file:///Users/your_name/works/xk6-cognito/examples/loadTest.js:7:0(42)
	at native  hint="script exception"

既に issue にて報告されているようでした 👀

🔗 Could not connect to cognito service · Issue #1 · tmieulet/xk6-cognito

以上、k6 で Amazon Cognito のアクセストークンを取得したかった、現場からお送りしました。