Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

768
Visualizações
AWS Lambda (.NET) + SQS: Error converting the Lambda event JSON payload to a string

i use AWS Lambda (.NET Core 2.1 environment) + SQS as trigger

The problem is that my lambda cannot parse my SQS message.

Error converting the Lambda event JSON payload to a string. JSON strings must be quoted, for example "Hello World" in order to be converted to a string: Unexpected character encountered while parsing value: {. Path '', line 1, position 1.: JsonSerializerException

Here is declaration of my handler:

public async Task<string> FunctionHandler(DummyMessage message, ILambdaContext context)

Model:

public class DummyMessage {
  public string Label { get; set; }
}

SQS input from AWS Console that I tried: {"Label":"qwerty"}, "{"Label":"qwerty"}", "{\"Label\":\"qwerty\"}", but same error occurs.

Could you please help with this issue?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

When passing Json try JObject from Newtonsoft.Json.Linq

FunctionHandler(JObject eventStr, ILambdaContext context)

and then you can Deseralize the response where SQSEvent is inherited from Amazon.Lambda.SQSEvents SDK Library.

var result = eventStr.ToObject<SQSEvent>();
over 4 years ago · Santiago Trujillo Relatório

0

Also, do not forget to add/change aws serializer :

[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))]
namespace AwsLambdaHandleTelegramWebhooks
{
   public class Function
   {
      public  APIGatewayProxyResponse FunctionHandler(JObject input,ILambdaContext context)
      {
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda