Skip to content

Commit c10deda

Browse files
Fixes
1 parent 25b3844 commit c10deda

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

lib/aws/client-factory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class AWSClientFactory {
7373

7474
if (serviceName === 'S3' && command._isUploadRequest) {
7575
const upload = new Upload({
76-
client: client,
76+
client,
7777
params: command.params,
7878
});
7979

lib/plugins/aws/invoke.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,21 @@ class AwsInvoke {
100100
return this.provider.request('Lambda', 'invoke', params);
101101
}
102102

103+
payloadToString(payload) {
104+
if (payload instanceof Uint8Array) {
105+
return new TextDecoder().decode(payload);
106+
}
107+
108+
if (Buffer.isBuffer(payload)) {
109+
return payload.toString();
110+
}
111+
112+
return payload;
113+
}
114+
103115
log(invocationReply) {
104116
if (invocationReply.Payload) {
105-
const payloadStr =
106-
invocationReply.Payload instanceof Uint8Array
107-
? new TextDecoder().decode(invocationReply.Payload)
108-
: Buffer.isBuffer(invocationReply.Payload)
109-
? invocationReply.Payload.toString()
110-
: invocationReply.Payload;
111-
112-
const response = JSON.parse(payloadStr);
117+
const response = JSON.parse(this.payloadToString(invocationReply.Payload));
113118

114119
writeText(JSON.stringify(response, null, 4));
115120
}

0 commit comments

Comments
 (0)