We have a requirement where we are expected to maintain the internal audit of requests/errors etc.
To do this, I have written the function as below:
async function createAuditRecordInternal(ctx: ReqContext, sourcefile: string, messagetype: string, message: any) {}
Here, “message” is of type any. It is done because it can accept instance of Request/Error/any custom type defined in our code.
In Oracle table, I have column of “CLOB” type to save the details that are sent in message.
const msg: OracleDB.BindParameter = {
dir: OracleDB.BIND_IN,
val: String(message),
type: OracleDB.STRING,
};
However, while logging the incoming request from postman OR instance of any custom type in Oracle column, I see [object Object].
Error caught in try-catch is inserted in db column as text.
Is there any way to convert the contents coming in “message” to text always?
Node Version: 21.7.3
Express: 4.19.2
OracleDB: 6.5.0