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?

preguntada hace un mes83 visualizaciones
1 Respuesta
1
Respuesta aceptada

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
EXPERTO
respondido hace un mes
profile picture
EXPERTO
revisado hace un mes
  • Glad that you found the solution. Thanks for accepting my answer.

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas