node-oracledb-for-lambda icon indicating copy to clipboard operation
node-oracledb-for-lambda copied to clipboard

ORA-12154: TNS:could not resolve the connect identifier specified

Open scrapex opened this issue 8 years ago • 0 comments

I keep getting the following error when running the lambda in aws "ORA-12154: TNS:could not resolve the connect identifier specified". The connection works fine when I try running on my local windows machine or even in an EC2 instance. The issue only happens when deploying on lambda.

I am running Nodejs 6.3 and have included all the necessary libraries. There seems to be an issue with the connection string but it works fine else where.

`exports.handler = function(event, context, callback) { console.log('event:', event); console.log('context:', context); try { oracledb = require('oracledb-for-lambda'); console.log('oracledb: supported');

  var conn = {
	  user: "my user",
	  password: "my password",
	  connectString: "DOMAIN:PORT/DATABASE",
	  externalAuth: false
	};

  oracledb.getConnection(conn, (err, connection) => {
	if (err) {
	  console.log("connection ERROR.."); ->> CODE FAILS HERE
	  console.error(err.message);
	  return;
	}
	console.log("connection successful..");
  });
	

} catch (e) {
    console.log('Failed to load oracledb:');
    console.log(e);
    callback('Failed to load oracledb');
}

if (oracledb != null) {
    callback(null, 'Oracle DB is supported');
} else {
    callback('Did not actually expect to see this, `require(\'oracledb\')` will fail');
}

}; `

scrapex avatar Nov 29 '17 18:11 scrapex