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?

feita há um mês83 visualizações
1 Resposta
1
Resposta aceita

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
ESPECIALISTA
respondido há um mês
profile picture
ESPECIALISTA
avaliado há um mês
  • Glad that you found the solution. Thanks for accepting my answer.

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas