Internal server error

I am getting error if i hit the endpoint via POSTMAN / rest client app

{
“message”: “Internal server error”
}

but if i hit the api via “test event” its success

{
“statusCode”: 200,
“headers”: {
“Content-Type”: “application/json”
},
“body”: {
“token”: “eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1YTM5YzM5ZGZhYjRmMTEyMzQ0YzQ4NDQiLCJyb2xlIjoiY3VzdG9tZXIiLCJpYXQiOjE1Mjc2OTA1ODgsImV4cCI6MTUyNzkwNjU4OH0.X9aqRqiZQm356UKGj2m0nrCWa-p6TYSTyrz3auX6MRs”,
“user”: {
“_id”: “5a39c39dfab4f112344c4844”,
“name”: “XXXXX”,
“email”: “XXXXX@gmail.com”,
“role”: “customer”
}
}
}

i have check the log in aws but no error found.

can someone please advice ?

It looks like you’re returning a JSON object in body. It needs to be a string. Wrap the value with a JSON.stringify() to convert it and it should be ok.

Hi @buggy

thanks for the help

it solved now.
i missed the JSON.stringify()

1 Like