-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Error message when running code #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There seams to be an error while you are connecting to your database. Please check for an error in the pg.connect function. |
Its a red line under 'events' in the line: Its in the file node_modules\pg\lib\index.js |
You're experiencing an issue connecting to your database. You need to handle the issue in your code. If you handle the error and still think it's related to node-postgres please let us know. Do this: ...
pg.connect(conString, function(err, client) {
if(err) throw err;
...
}); thanks |
Did that and got the error message "error: invalid startup packet layout: expected terminator as last byte". I looked around a bit and found a similar issue here. I implemented the fix, but then I got a new error message: I saw in this issue that you recommended to try using require('pg').native, so I did that. It did make the error message go away, but I got a new one instead:
That error message got referenced in this issue, but the only fix that came up there was to upgrade to node v0.8.1, which is the version I have. Here is my dependencies:
I'm at a loss here. |
what version of postgres are you using? The invalid terminator at last byte is an old and definitely fixed bug. Also, if you're running node v0.8.1 don't use pg version 0.5.4. Use the most recent version from npm. |
Yeah, just checked. pg 0.5.4 is extremely out of date. Please upgrade to either "pg": "*" or "pg": "0.8.1" |
Ah, I thought that was the newest version since that was the version npm installed. Updated to 0.8.1 now, but it didnt really help in any other way than to give me a bit more detailed error message:
There is red lines under the words inside the apostrophes in the first lines in the file D:\jobb\app\node_modules\pg\lib\connection.js, does that tell you anything?
Also, the connect function (pg.connect(conString, function(err, client) {}) goes to the file D:\jobb\app\node_modules\pg\test\integration\connection\test-helper.js, should it do that? It doesnt seem logical to use a function in a test folder. I got an error message when I installed pg:
But you did write in issue 146 that as long as pure JavaScript bindings was used it wasnt a problem. And to answer your question, I have postgres version 9.1 installed. |
@linnhege are you sure you are using the right connection string? Have you configured postgres for the user you use in the connection string? |
That error message means it cannot find your credentials in your pg_hba.conf file -- meaning you're using the wrong credentials to log in. What version of node are you using? Do you have a configuration entry for the user not requiring SSL? I am still working on getting SSL support into the pure javascript bindings. Can you gist the code causing an issue? |
I'm using Heroku so SSL is required for all connections. I copy/pasted the credentials from the connection settings on Heroku's site so they should be correct. It works perfectly fine when I connect to the database with pgAdmin and psql. I'm using v0.8.4 of Node. Is this fine? https://gist.github.com/3348325 There I tried to just use your example code, which gave me this error message:
|
node-postgres doesn't support SSL yet |
Oh, that sucks. Brian, do you think this functionality will be implementet soon, or should I start looking for other solutions? |
It's number 1 on my list of things to support. Been really busy past 2 weeks w/ personal stuff -- hopefully this weekend I'll have it in. In the mean time node-postgres does support SSL if you use the native bindings. Just change |
this, in particular, is what I plan on merging in - really I just need to test it more extensively (i.e. integration tests) |
This should be implemented by now. I'm closing the ticket therefore. |
Hi!
I working on setting up my first node.js and postgres app and I keep getting this error message when I try to run my code:
Here is my web.js code:
Am I doing something wrong or is there a bug in your pg-code?
The text was updated successfully, but these errors were encountered: