Skip to Main Content
  • Questions
  • On Lambda Execution : Error: DPI-1047: Cannot locate a 64-bit Oracle Client library: libclntsh.so

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Raju.

Asked: June 12, 2020 - 8:53 am UTC

Last updated: January 11, 2022 - 3:46 am UTC

Version: oracledb@4.2.0

Viewed 10K+ times! This question is

You Asked

Error: DPI-1047: Cannot locate a 64-bit Oracle Client library: "libclntsh.so: cannot open shared object file: No such file or directory".
You must have 64-bit Oracle client libraries in LD_LIBRARY_PATH, or configured with ldconfig.

Above is the issue on running function on aws lambda.

// lib/libclntsh.so is available.

I have added the path also the code is working locally on windows machine. but not on aws lambda.


'use strict';

process.env.ORA_SDTZ = 'UTC';
process.env.LD_LIBRARY_PATH = '$LAMBDA_RUNTIME_DIR:$LAMBDA_RUNTIME_DIR/lib:$LAMBDA_TASK_ROOT:$LAMBDA_TASK_ROOT/lib';

const oracledb = require('oracledb');
oracledb.outFormat = oracledb.OUT_FORMAT_OBJECT;

module.exports.getmrl = async event => { //console.log(event); console.log(process.env.LAMBDA_RUNTIME_DIR, process.env.LAMBDA_TASK_ROOT);
// console.log('LD path ', process.env.LD_LIBRARY_PATH);
return getMrl();
};

async function getMrl() {

let connection;

try {
connection = await oracledb.getConnection({
user : process.env.DB_USER,
password : process.env.DB_PASS,
connectString : process.env.DB_CON_STRING
});

const result = await connection.execute(
`select M.MRL,I.DOC_URL from appdbdev.IA_MRL M INNER JOIN appdbdev.IA_MRL_DOCUMENTS I USING(IA_ID) ORDER BY M.ID`
);
console.log('result ::', result.rows);
return { statusCode : 200, data : result.rows };
} catch (err) {

console.log('getmrl :: error ::', err);
console.error(err);
return { statusCode : 500, err : err };

} finally {

if (connection) {
try {
await connection.close();
} catch (err) {
console.log('getmrl :: connection :: catch', err);
console.error(err);
return { statusCode : 401, err : err };
}
}

}
}



and Connor said...

Add $ORACLE_HOME/lib to your LD_LIBRARY_PATH


[oracle@db19 dbhome_1]$ cd $ORACLE_HOME
[oracle@db19 dbhome_1]$ find . -name "libcl*" 
./lib/libclntsh.so.10.1
./lib/libclntshcore.so
./lib/libclsr19.a
./lib/libclntsh.so
./lib/libclsnsjni19.so
./lib/libclsce19.so
./lib/libclscest19.a
./lib/libclntshcore.so.19.1
./lib/libclsra19.so
./lib/libclscred19.so
./lib/libclient19.a
./lib/libclntst19.a
./lib/libclntsh.so.19.1
./lib/libclntsh.so.11.1
./lib/libclntsh.so.12.1
./lib/libclntsh.so.18.1

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Answer Didn't worked

Jasnoor, December 20, 2021 - 9:48 am UTC


Connor McDonald
January 11, 2022 - 3:46 am UTC

Well...I see brevity is your preference :-)

More to Explore

Administration

Need more information on Administration? Check out the Administrators guide for the Oracle Database