AWS Lambda function response is Uint8Array

1

I have a Lambda function which calls another Lambda function, this works ok, but, the response from the called function should be a JSON object, but it gets converted somewhere into an Uint8Array! I'm not able to parse this array (or, it's proving tricky), is there a way to get the returned data in a usable form?

質問済み 1ヶ月前83ビュー
1回答
1
承認された回答

Hi,

UInt8Array (=array of unsigned btyes) means that you deal with bytes instead of a string

You must convert this array to a string to make your life easier.

Something like the following should solve your issue

const asciiDecoder = new TextDecoder('ascii');
const data = asciiDecoder.decode(YourArray);

Best,

Didier

profile pictureAWS
エキスパート
回答済み 1ヶ月前
profile picture
エキスパート
レビュー済み 1ヶ月前
  • Glad that you found the solution. Thanks for accepting my answer.

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ