grafana / k6-jslib-aws

Javascript Library allowing to interact with AWS resources from k6 scripts
Apache License 2.0
18 stars 28 forks source link

ssm error: Object has no member 'json' #83

Open christopher-ab opened 7 months ago

christopher-ab commented 7 months ago

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)
                }))
oleiade commented 7 months ago

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