grafana / k6-jslib-aws

Javascript Library allowing to interact with AWS resources from k6 scripts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ssm error: Object has no member 'json'

christopher-ab opened this issue · comments

I found an issue when trying to call getParameter method on ssm.js. It says Uncaught (in promise) TypeError: Object has no member 'json'. Any help is really appreciated

I guess the culprit is this (taken from https://jslib.k6.io/aws/0.11.0/ssm.js)

value: (t = Oe().mark((function e(t) {
                    var r, n, o, i = arguments;
                    return Oe().wrap((function(e) {
                        for (;;) switch (e.prev = e.next) {
                            case 0:
                                return r = i.length > 1 && void 0 !== i[1] && i[1], n = this.signature.sign({
                                    method: this.method,
                                    endpoint: this.endpoint,
                                    path: "/",
                                    headers: je(je({}, this.commonHeaders), {}, Re({}, C, "AmazonSSM.GetParameter")),
                                    body: JSON.stringify({
                                        Name: t,
                                        WithDecryption: r
                                    })
                                }, {}), e.next = 4, de().asyncRequest(this.method, n.url, n.body, {
                                    headers: n.headers
                                });
                            case 4:
                                return o = e.sent, this._handle_error(He.GetParameter, o), e.abrupt("return", Ne.fromJSON(o.json())); //this is the culprit
                            case 7:
                            case "end":
                                return e.stop()
                        }
                    }), e, this)
                }))

Hey @christopher-ab 👋🏻

Would you be able to provide us with an example script demonstrating how you use the library, and what your getParameter call looks like? That would be much appreciated to help us reproduce and try to debug the issue 🙇🏻

For reference, the source code for this method can be found there: https://github.com/grafana/k6-jslib-aws/blob/main/src/internal/ssm.ts#L54