I am working on building out my PostgreSQL database with Knex and I keep getting this error when I run knex migrate:latest.
error: password authentication failed for user "Joshua Rieth"
at Parser.parseErrorMessage (C:\Users\Joshua Rieth\Documents\Projects\Lambda\Labs\homerun-be\node_modules\pg-protocol\dist\parser.js:278:15)
at Parser.handlePacket (C:\Users\Joshua Rieth\Documents\Projects\Lambda\Labs\homerun-be\node_modules\pg-protocol\dist\parser.js:126:29)
at Parser.parse (C:\Users\Joshua Rieth\Documents\Projects\Lambda\Labs\homerun-be\node_modules\pg-protocol\dist\parser.js:39:38)
at Socket.<anonymous> (C:\Users\Joshua Rieth\Documents\Projects\Lambda\Labs\homerun-be\node_modules\pg-protocol\dist\index.js:8:42)
at Socket.emit (events.js:315:20)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:271:9)
at Socket.Readable.push (_stream_readable.js:212:10)
at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
I am assuming that is that it has to do with my username, but it should be the default postges user that I used when setting up PostgreSQL. I should also mention that the user and password is in a .env file.
Spec
PostgreSql 12
Windows 10
NPM 6.14.6
pg 8.3.0
knex 0.20.15
When you set up knex you need to supply the username / password, unless you'd like to connect as a "current OS user". There are multiple places where you could have set up the credentials, so it would be nice if you could check them all (and inform us :) ).
One way of doing this is:
require('knex')({
client: 'pg',
connection: 'postgres://username:password#localhost:5432/dbname'
})
Alternatively, you could set up environment variables PGUSER and PGPASSWORD, Knex connection would pick those up too.
Your connection could also be configured with full details rather than the link:
var knex = require('knex')({
client: 'pg',
version: '12.0',
connection: {
host : '127.0.0.1',
user : 'your_database_user',
password : 'your_database_password',
database : 'myapp_test'
}
});
To exclude your usernames / passwords from the actual code I would strongly suggest you use something like dotenv package: https://www.npmjs.com/package/dotenv
(NB: below is not about your specific error, as your username is not specified correctly) Another thing that I would check on Pg side is that you have enabled password authentication in your pg_hba.conf. md5 method allows for the password-hash based authentication, which should be good for you. It should look like this:
# TYPE DATABASE USER CIDR-ADDRESS METHOD
host all all 123.123.123.123/32 md5
Related
I'm trying to set up email for a Laravel project using SendGrid.
When following their documentation I get an error (https://sendgrid.com/docs/Integrate/Frameworks/laravel.html)
The .env looks like this
MAIL_DRIVER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME=yea****
MAIL_PASSWORD=*********
MAIL_ENCRYPTION=tls
MAIL_FROM_NAME="John Smith"
MAIL_FROM_ADDRESS=from#example.com
The error i get looks like this
ErrorException (E_WARNING)
stream_socket_enable_crypto(): Peer certificate CN=`****.****.***' did not match expected CN=`smtp.sendgrid.net'
/home/myusername/public_html/api/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php
public function startTLS()
{
// STREAM_CRYPTO_METHOD_TLS_CLIENT only allow tls1.0 connections (some php versions)
// To support modern tls we allow explicit tls1.0, tls1.1, tls1.2
// Ssl3 and older are not allowed because they are vulnerable
// #TODO make tls arguments configurable
return stream_socket_enable_crypto($this->stream, true, STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT);
}
Arguments
"stream_socket_enable_crypto(): Peer certificate CN=`****.****.***' did not match expected CN=`smtp.sendgrid.net'"
I fixed this error by using the code provided in this answer (https://stackoverflow.com/a/45315825).
I know this is bad practice but i got another error.
Swift_TransportException
Failed to authenticate on SMTP server with username "yea****" using 2 possible authenticators. Authenticator LOGIN returned Swift_TransportException: Expected response code 235 but got code "535", with message "535 Incorrect authentication data " in /home/myusername/public_html/a[i/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:456 Stack trace: #0
/home/myusername/public_html/api/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php
$message = 'Failed to authenticate on SMTP server with username "'.$this->username.'" using '.$count.' possible authenticators.';
foreach ($errors as $error) {
$message .= ' Authenticator '.$error[0].' returned '.$error[1].'.';
}
throw new Swift_TransportException($message);
}
}
This looks like some kind of authentication error to me, I am using the same credentials i use to login to the SendGrid dashboard.
any ideas on how to fix these problems?
My solution for this case was double-quote the username, password and port number.
Then I got another error, like this:
'''
Connection to tcp://smtp.hostx.com:465 Timed Out
'''
Connection to tcp://smtp.hostx.com:465 Timed Out
and I fix it changing MAIL_ENCRYPTION from tls to ssl:
MAIL_ENCRYPTION=ssl
I hope this helps someone else due to this post is too old.
I'm trying to check if the oracle DB connection using the Keyword:
Connect To Database Using Custom Params
Following libraries are imported:
Database Library
JayDeBe API
This this is the connection string used:
'oracle.jdbc.driver.OracleDriver', 'jdbc:oracle:thin:#//DBHostname:Port/DBName', ['user', 'pass']
We do not get any response that can identify if the connection is established or rejected.
We see this message in RIDE:
'oracle.jdbc.driver.OracleDriver', 'jdbc:oracle:thin:#//DBHostName:Port/DBName', ['user', 'pass']
20170927 17:07:54.438 : INFO : Executing : Connect To Database Using Custom Params : jaydebeapi.connect(db_api_2.connect('oracle.jdbc.driver.OracleDriver', 'jdbc:oracle:thin:#//DBHostName:Port/DBName', ['user', 'pass']))
Can someone please help us?
We found the solution: In our case we have python 2.7(32bit) therefore we need the following:
1. Oracle Instant Client Downloads for Microsoft Windows (32-bit). you can download it from here: http://www.oracle.com/technetwork/topics/winsoft-085727.html
Set the variable path in environment variable for the Oracle Instant client.
Download cx_Oracle API (32bit- cx_Oracle-6.0.2-cp27-cp27m-win32.whl (md5) ) from the location:https://pypi.python.org/pypi/cx_Oracle/
Open command prompt and run: pip install cx_Orcle --upgrade
Open the RIDE and use the following keyword:
Connect To Database Using Custom Params cx_Oracle 'user', 'password', 'DBHOSTNAME:PORT/DBNAME'
I've downloaded and executed DHIS-2 in the Windows operating system. I want to connect with a PostgreSQL database. I'm trying the below configuration settings in the dhis.conf file but it's not working.
connection.dialect = org.hibernate.dialect.PostgreSQLDialect
connection.driver_class = org.postgresql.Driver
connection.url = jdbc:postgresql:dhis2
connection.username = dhis
connection.password = dhis
connection.schema = update
encryption.password = abcd
It's showing me following error message.
HTTP ERROR: 503
Problem accessing /. Reason:
Service Unavailable
Please verify that the database name, username and password is correct.
You can test this on the command line / terminal with the following command:
psql -d dhis2 -U dhis -p
Then enter your password. If you cannot connect, one or more of database name, username and password are incorrect.
FTPClient client = new FTPClient();
try
{
client.connect(currentServerHostname);
System.out.println("Connection is successful");
System.out.println("Reply String: " + client.getReplyString());
client.login(currentServerUser, currentServerPass);
System.out.println("login ok");
System.out.println("Reply String: " + client.getReplyString());
}
catch (Exception e) {
System.out.println("No connection was established");
}
This code shows error like 530 Pass command failed in the line client.login() method.
Maybe you are trying to login with a user with a RACF account but that user (maybe) don't have an UID defined in the OMVS segment.
See if this helps:
Problem(Abstract)
An FTP client user attempts to log on to a z/OS FTP server. After the correct password is entered for user verification, the following server reply is received:
530 PASS command failed
Diagnosing the problem
With the ACC and FLO DEBUG options specified for the FTP server (see the section "Documentation for FTP Server Problems" in the Technote MustGather: Collect Troubleshooting Data for FTP for the z/OS Communications Server for instructions on starting an FTP server trace), the following messages are included in the FTP server trace:
RA0786 pass: use __passwd() to verify the user
RA0809 pass: __passwd() failed - EDC5163I SAF/RACF extract error. (errno2=0x090C1C00)
RA0888 pass: The username access has been revoked
SR2910 reply: entered
SR2947 reply: --> 530 PASS command failed
In v1r12 and later, the messages appear as:
RA0862 pass: use __passwd() to verify the user
RA1100 pass: getpwnam() failed - EDC5163I SAF/RACF extract error. (errno2=0B490808)
SR3360 reply: entered
SR3397 reply: --> 530 PASS command failed
Consider adding an ACCESSERRORMSGS TRUE statement to the FTP.DATA input used by the server (typically referenced via the SYSFTPD DD in the started proc). This will cause the server to provide more information to the end user about the nature of any logon failure (besides just '530 PASS command failed'). Some sites' security policies restrict providing more information in these cases, which is ACCESSERRORMSGS defaults to FALSE.
Resolving the problem
Each user logging in to the FTP server must have a UID defined in the user's OMVS segment. In this case, the user logging in does not have a UID defined in the OMVS segment, resulting in the PASS command failure. To resolve the problem, define a UID in the user's OMVS segment.
I follow the basic installation tutorial on for the mean stack on OS X.
MongoDB is running and all dependencies are believed to be installed.
During init of my first app, the script fails when asking for the admin user password (it fails before I am allowed to input anything as my admin password):
$ mean init myApp
? What would you name your mean app? myApp
? The Mean project is currently in developer preview. To help improve the -
quality of this product, we collect anonymized data on how the mean-cli is used -
You may choose to opt out of this collection now (by choosing 'N' at the below prompt)
or at any time in the future by running the following command:
mean disable user-reporting
Do you want to help us improve the mean network (Y/n)? Y
? Please provide your email so we can create your first admin user: joe#doe.com
? Please provide your username so we can create your first admin user: admin
Cloning branch: master into destination folder: myApp
git clone --depth 1 -bmaster https://github.com/linnovate/mean.git "myApp"
Cloning into 'myApp'...
##############################################################
#
# !!! MONGOOSE WARNING !!!
#
# This is an UNSTABLE release of Mongoose.
# Unstable releases are available for preview/testing only.
# DO NOT run this in production.
#
##############################################################
DB connection successful!
Please provide password so we can create your first admin user
prompt: password: /usr/local/lib/node_modules/mean-cli/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/base.js:246
throw message;
^
TypeError: Cannot read property 'length' of undefined
at processResults (/usr/local/lib/node_modules/mean-cli/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1581:31)
at /usr/local/lib/node_modules/mean-cli/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1619:20
at /usr/local/lib/node_modules/mean-cli/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1157:7
at /usr/local/lib/node_modules/mean-cli/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1890:9
at Server.Base._callHandler (/usr/local/lib/node_modules/mean-cli/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/base.js:448:41)
at /usr/local/lib/node_modules/mean-cli/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:481:18
at MongoReply.parseBody (/usr/local/lib/node_modules/mean-cli/node_modules/mongoose/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
at null.<anonymous> (/usr/local/lib/node_modules/mean-cli/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:439:20)
at emit (events.js:107:17)
at null.<anonymous> (/usr/local/lib/node_modules/mean-cli/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:201:13)
I am able to create users manually in the resulting app folder.
But the resulting application seems to be incomplete and I cannot start it.
$ mean user joe#doe.com --addRole admin;
Adding role `admin` to user `joe#doe.com`
##############################################################
#
# !!! MONGOOSE WARNING !!!
#
# This is an UNSTABLE release of Mongoose.
# Unstable releases are available for preview/testing only.
# DO NOT run this in production.
#
##############################################################
DB connection successful!
successfully updated
You need to install mongo database.
http://www.liquidweb.com/kb/how-to-install-mongodb-on-ubuntu-14-04/