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?

asked 13 days ago61 views
1 Answer
1
Accepted Answer

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
EXPERT
answered 13 days ago
profile picture
EXPERT
reviewed 13 days ago
  • Glad that you found the solution. Thanks for accepting my answer.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions