Выполнение не выполнено из-за ошибки конфигурации: неверный ответ лямбда-прокси в Node JS лямбда - PullRequest
0 голосов
/ 10 апреля 2020

Это Node JS Лямбда, я возвращаю код состояния 200 в качестве ответа, когда я вызываю свою лямбда-функцию через шлюз API, я получаю ошибку 502, я отправляю пост-запрос на мой URL-адрес шлюза API. Я использую Lambda Proxy API-интеграцию.

      request( options, function ( error, res, body ) {
            if ( error ) {
                console.log( "this is error", error );
                return callback( error );
            } else {
                // console.dir( body );
                const response = {
                    statusCode: 200,
                    body: JSON.stringify({
                      message: 'Your function executed successfully!',
                    //   input: event,
                    }),
                  };
                return callback( null, {
                    response,
                } );
            }
        } );

Я вижу это журналы

(543396a4-952b-451e-8e61-6aeedd2463e9) Endpoint response body before transformations: 
{
    "response": {
    "statusCode": 200,
    "body": "{\"message\":\"Your function executed successfully!\"}"
}
}
 (543396a4-952b-451e-8e61-6aeedd2463e9) Execution failed due to configuration error: 
 Malformed Lambda proxy response
 (543396a4-952b-451e-8e61-6aeedd2463e9) Method completed with status: 502
...