im trying to inster into RDS Postgresql via URL provided by Api Gateway (im using postman to test), when i test a the Lambda function thru the test console it works and the data inserted to Postgresql, but i try to do it via Postman it doesn't work and my tale filled with null data and as i respond i get "The test undefined is inserted" :
im using node js and here is my code :
const { Pool, Client } = require('pg')
const pool = new Pool({
user: '#########',
host: '#########',
database: '#########',
password: '#########',
port: #########,
})
exports.handler = async (event) =>{
//TO DO
pool.connect()
let test_id= event['test_id']
let test_name = event['test_name']
let test_job = event['test_job']
await pool.query('INSERT INTO TABLE_NAME(test_id, test_name, test_job)VALUES($1, $2, $3)', [test_id, test_name, test_job])
.then((res)=> console.log(res))
.catch((err)=> console.log(err))
return{
statusCode: 200,
body: JSON.stringify('The test ' + test_name + ' is inserted')
}
};