Error connecting Remote Oracle database in Node.js - node.js

I am new to NodeJS. I am unable to connect remote Oracle database using node-oracledb and getting following error.
ORA-01017: invalid username/password; logon denied
Now, the twisting part is, using same connection detail, I can able to connect Oracle Remote Database using SQLDeveloper app.
I have install Nodejs using Brew on Mac OS X El Capitan and Oracle instant client 12.1.
I also tried SqlPlus but unable to connect Oracle remote database.
The firewall is also turned off. Following code is working on another Mac OS X El Capitan with same configuration.
oracledb.getConnection(
{
user : “phtest",
password : "Ahora#dev0000”,
connectString : “MYSEREVER/AMITDEV"
},
function(err, connection)
{
if (err) { console.error(err.message); return; }
connection.execute(
"SELECT * " +
"FROM OT_Category_Master",
function(err, result)
{
if (err) { console.error(err.message); return; }
res.json(result.rows);
});
});

The OS X 12.1 Instant Client was patched yesterday to fix a problem connecting to older DBs with case sensitive passwords. The symptom was ORA-01017. Re-download Instant Client and try again.
I update my announcement blog post to mention this.

Related

Connection error in AWS RDS SSL in NodeJS

I am trying to connect to RDS through Lambda NodeJS 12.x with SSL. However I am receiving these errors:
Error: 4506652096:error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol:
library: 'SSL routines',
function: 'ssl_choose_client_version',
reason: 'unsupported protocol',
code: 'HANDSHAKE_SSL_ERROR'
I am connecting like this:
const pool = mysql.createPool({
connectionLimit : 10,
host : 'db.cqgcxllqwqnk.eu-central-1.rds.amazonaws.com',
ssl : {
ca : fs.readFileSync(__dirname + '/rds-ca-2019-root.pem')
},
user : ‘xxxxx’,
password : ‘xxxxxx’,
database : ‘xxxxxx’,
multipleStatements : true
});
When I connect with the certificate through MySql Workbench everything works just fine.
Any idea on how to solve this?
Thanks a lot!
The problem was related to Mysql version and TLS version. This matrix shows that for MySQL 5.6 only TLS 1.0 is supported. Node.js 12 by default uses TLS 1.2.
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_MySQL.html#MySQL.Concepts.SSLSupport
Do this before connect as this have insufficent permission over file
sudo chmod 755 rds-combined-ca-bundle.pem
Warning: keep a strong password, this password easily guessable
if you still find problem, check IAM permission to lambda or check whether both RDS and lambda in same VPC.

Pubnub invalid timestamp

I always get this from my console, whenever I use PAM and grant.
Object {message: "Invalid Timestamp"}
I already setup NTP to my ubuntu server but still nothing change.
my pubnub grant is here:
pubnub.grant({
channel : channel,
callback : function (m) { console.log("grant success: ", m); },
error : function (m) { console.log("grant error: ", m); },
ttl : 5, // Minutes
read : true,
write : false,
auth_key : 'auth_key_here'
});
What is wrong with my code? Thanks for the help.
please follow the given steps to setup NTP server for the pubnub.
Step 1 Installation NTP
$ sudo apt-get update
$ sudo apt-get install ntp
Step 2 Edit ntp.conf
Replace these four with pubnub server
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org
to
server 0.pubsub.pubnub.com
server 1.pubsub.pubnub.com
server 2.pubsub.pubnub.com
server 3.pubsub.pubnub.com
Step 3 Restart NTP Service
$ sudo service ntp restart

Error: password_hash(): Password must be a string in laravel

An ErrorException occurred in my code $user->password = Hash::make(Input::get('password'));
saying password_hash(): Password must be a string. I am using laravel framework
$user = new User();
$user->username = Input::get('username');
$user->password = Hash::make(Input::get('password'));
if($user->save())
{
return Redirect::route('home')->with('success','You register successfully. You can now login');
} else {
return Redirect::route('home')->with('fail','An error occurred while creating user. Please try again.');
}
I experienced the same issue, using wamp 2.4 which comes with PHP 5.4, but after upgrading to wamp 2.5 which comes with php 5.5, it was solved so thats solution number 1:
If you are running a lower version of php then you might want to upgrade.
Still looking for a solution that doesnt require an upgrade because on Laravel's documentation, it mentions that 5.4+ is supported for Laravel 4.2
I had similar issue on a Linux machine which threw in
ErrorException
password_hash(): Password must be a string
By upgrading PHP from PHP 5.4 to PHP 5.5 it solved it on my Laravel environment.

Signature does not match for AWS using Node.js SDK

I'm unable to get a simple AWS Node.js EC2 example to work. Here's my code:
var AWS = require('aws-sdk');
AWS.config.loadFromPath('./config.json');
new AWS.EC2().describeInstances(function(err, data) {
if (err) {
console.log(err);
} else {
console.log(data);
}
});
The error I get when running it looks like this:
{ [SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.]
message: 'The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.',
code: 'SignatureDoesNotMatch',
time: Wed Sep 03 2014 16:29:37 GMT-0700 (PDT),
statusCode: 403,
retryable: false }
Why am I getting this error and how do I resolve it?
I'm using Node.js v0.10.31 on an Ubuntu 14.04.1 LTS 64-bit desktop.
Download a complete example here or here.
crossposted here: https://forums.aws.amazon.com/thread.jspa?threadID=160122
sudo pip install awscli fixed the issue.
aws --version now returns aws-cli/1.7.14 Python/2.7.6 Linux/3.13.0-49-generic

Unable to query mongolab mongodb

I'm using the Nodejitsu and their packaged Mongolab MongoDB database. I ran the command jitsu databases get myDB and I got instructions on how to connect via mongo CLI. The out put of that command has a line that says the following:
help: Connect with the `mongo` cli client:
help:
$ mongo ds039267.mongolab.com:39267/nodejitsu_xxxxxx_nodejitsudb8577296358 -u nodejitsu_xxxxxx -p mypassword
NOTE: This is the first time I am connecting to this instance via the CLI. I only created the database name through jitsu databases create…
I am using Mongo Shell version 1.8.3. I connected to my instance of MongoDB. I tried running the command: show dbs and I got:
uncaught exception: listDatabases failed:{ "ok" : 0, "errmsg" : "unauthorized" }
I am using Mongoose and I have a model called Post. I tried to run: db.post.find() in the CLI, I got:
error: { "$err" : "not authorized for query on hotel.post", "code" : 16550 }
What does this mean? Am I not authorized; I thought I connected successfully?
Updated
I upgraded my mongo shell to the latest, 2.4.x version and still I'm getting this problem. Anyone have any experience with nodejitsu & mongolab?
MongoLab creates databases that require an authenticated user to access. When you connect with the Shell, you will need to provide the UserName and Password to the shell command. Docs are here.
mongo --username Mark --password something
You will need that Username/Password combination to be configured within mongoose as well. The Mongoose docs have details on the possible ways to do this.
Note that you are using a very old shell. 1.8.3 is about 4 versions back from the current 2.4.* line. This is not directly related to your problem, but it's definitely something you should rectify going forward.
Inside the mongo shell try to authenticate once again:
db.auth('yourUsername','yourPassword');
One possible error could be like me : Using special chars in the password breaks the URI!
The generated password was
X/apm~nq5JaJ,5
So OBVIOUSLY, the / broke the request and I got :
MongoError: not authorized for query on apm~nq5JaJ.system.indexes
You can try to include at the end of your URI: ?authMode=scram-sha1

Resources