Closed ptmkenny closed 3 years ago
Thanks for filing @ptmkenny!
When I did that, I realized that following the docs commits the node_modules directory when updating, but node_modules is not committed in the initial setup. Is that correct?
Nice catch! It's a mistake that node_modules
are committed in the instructions (I happen to have a global gitignore that will never add a node_modules
directory, hence "works for me" syndrome) We'll fix that up :)
The SSL "off" part is baffling though since the documentation example explicitly turns on SSL. If you don't commit the node_modules directory, does everything start working?
Thanks for your response. If you're updating the docs, another change is that github has switched the names of all new master
branches to main
.
As for the error, I removed the node_modules
directory, but I am basically getting the same error:
2021-01-06T17:08:55.859564+00:00 app[web.1]: > lhci@1.0.0 start /app
2021-01-06T17:08:55.859564+00:00 app[web.1]: > node server.js
2021-01-06T17:08:55.859564+00:00 app[web.1]:
2021-01-06T17:08:56.472004+00:00 app[web.1]: Starting server...
2021-01-06T17:08:57.086691+00:00 app[web.1]: (node:23) UnhandledPromiseRejectionWarning: SequelizeConnectionError: no pg_hba.conf entry for host "3.83.55.175", user "ntzkkfdytdknmc", database "dd0nngfvnuvhp9", SSL off
2021-01-06T17:08:57.086702+00:00 app[web.1]: at /app/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:154:24
2021-01-06T17:08:57.086703+00:00 app[web.1]: at Connection.connectingErrorHandler (/app/node_modules/pg/lib/client.js:194:14)
2021-01-06T17:08:57.086704+00:00 app[web.1]: at Connection.emit (events.js:314:20)
2021-01-06T17:08:57.086705+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/pg/lib/connection.js:134:12)
2021-01-06T17:08:57.086705+00:00 app[web.1]: at Socket.emit (events.js:314:20)
2021-01-06T17:08:57.086706+00:00 app[web.1]: at addChunk (_stream_readable.js:297:12)
2021-01-06T17:08:57.086706+00:00 app[web.1]: at readableAddChunk (_stream_readable.js:272:9)
2021-01-06T17:08:57.086707+00:00 app[web.1]: at Socket.Readable.push (_stream_readable.js:213:10)
2021-01-06T17:08:57.086707+00:00 app[web.1]: at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
2021-01-06T17:08:57.086821+00:00 app[web.1]: (node:23) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
2021-01-06T17:08:57.086940+00:00 app[web.1]: (node:23) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
2021-01-06T17:08:57.189421+00:00 heroku[web.1]: Process exited with status 0
2021-01-06T17:08:57.233810+00:00 heroku[web.1]: State changed from starting to crashed
Thanks for the push on main
we'll update that too 👍
As for the SSL issue, I'm not sure and unfortunately don't have the bandwidth to investigate right now. If it helps, this is the exact commit that is running on our testing heroku deployment that is not having any issues.
https://github.com/GoogleChrome/lighthouse-ci/tree/heroku-deploy
Just chiming in that I'm also seeing the same error on a clean install + new heroku account.
(node:23) UnhandledPromiseRejectionWarning: SequelizeConnectionError: no pg_hba.conf entry for host ...
Hi @patrickhulce
I've also run into this issue. Could you please help with it? Thank you.
cc @addyosmani
Alright something has clearly changed with heroku account setup since the docs were written then. We'll look into when we get the chance.
@ryan-ludwig @anton-karlovskiy @ptmkenny are any of your implementations of LHCI open source so I could take a look at the exact config/env that you're using to trigger this?
@patrickhulce
Thank you for your reply.
Actually, it used to be working, but after upgrading the Postgres plan following https://devcenter.heroku.com/articles/upgrading-heroku-postgres-databases#upgrading-with-pg-copy, the Lighthouse CI Server Heroku app was broken. Here is the Heroku log:
I'm wondering if it's related to https://github.com/sequelize/sequelize/issues/956.
@patrickhulce
are any of your implementations of LHCI open source so I could take a look at the exact config/env that you're using to trigger this?
Here is the LHCI server: lhci-heroku.zip
@anton-karlovskiy thanks for the code! If you change it to
createServer({
port: process.env.PORT,
storage: {
storageMethod: 'sql',
sqlDialect: 'postgres',
sqlConnectionSsl: true,
sqlConnectionUrl: process.env.DATABASE_URL,
sqlDialectOptions: {ssl: true}, // note this new line
},
})
does it work?
@patrickhulce
Thank you for your reply. Let me try and update you shortly.
@patrickhulce
WOW! It's working. Thank you very much for your help.
cc @addyosmani
Hm, that's so weird I don't know what changed that makes your use of Heroku need the extra bit and ours not, but we'll update the docs either way 👍
@patrickhulce it works 🥳. Thanks!
This happened for me when I started the heroku postgres in hobby mode, then updating to standard triggered this issue.
This fixed it https://github.com/GoogleChrome/lighthouse-ci/issues/519#issuecomment-767121025
docs were updated in 0f5c2ddbc7faedaaf32b5dc8c83678776636460e thanks for your patience trying fixes til we figured it out everyone! 🎉
tried to set it up today using the latest instruction provided and still face the same problem as author of this issue
@radzivil specifically your server.js file contains the line inside the storage
property found here?
@patrickhulce yes, sqlDialectOptions: {ssl: true} option is set. However, result is the same
Can you share the exact log messages produced and exact config used?
2021-02-16T16:38:48.811008+00:00 heroku[web.1]: State changed from crashed to starting
2021-02-16T16:38:57.152537+00:00 heroku[web.1]: Starting process with command `npm start`
2021-02-16T16:39:01.350892+00:00 app[web.1]:
2021-02-16T16:39:01.350915+00:00 app[web.1]: > lhci@1.0.0 start /app
2021-02-16T16:39:01.350916+00:00 app[web.1]: > node server.js
2021-02-16T16:39:01.350916+00:00 app[web.1]:
2021-02-16T16:39:02.166551+00:00 app[web.1]: Starting server...
2021-02-16T16:39:02.182462+00:00 app[web.1]: Trying to start application on port: 46965
2021-02-16T16:39:03.282937+00:00 heroku[web.1]: Process exited with status 0
2021-02-16T16:39:03.353749+00:00 heroku[web.1]: State changed from starting to crashed
'use strict';
const {createServer} = require('@lhci/server');
console.log('Starting server...');
console.log('Database connection string: ', process.env.DATABASE_URL);
console.log('Trying to start application on port: ', process.env.PORT);
createServer({
port: process.env.PORT || 3000,
storage: {
storageMethod: 'sql',
sqlDialect: 'postgres',
sqlConnectionSsl: true,
sqlDialectOptions: {ssl: true},
sqlConnectionUrl: process.env.DATABASE_URL,
},
}) .then(({port}) => console.log('Listening on port', port))
.catch(error => console.log('error => ', error));
@radzivil those logs don't indicate anything about a SSL connection error like this issue. That appears to be completely unrelated.
Unfortunately, we don't have the bandwidth to help debug one-off crashes. If you're able to get a stack trace or some sort of detailed error message coming from LHCI or a group of common users that have this problem, please file a new issue with the details so we can look into a fix.
Hello, I meet the same issue
2021-02-17T11:28:05.021426+00:00 heroku[web.1]: Starting process with command npm start
2021-02-17T11:28:08.359384+00:00 app[web.1]:
2021-02-17T11:28:08.359414+00:00 app[web.1]: > lhci@1.0.0 start /app
2021-02-17T11:28:08.359414+00:00 app[web.1]: > node server.js
2021-02-17T11:28:08.359414+00:00 app[web.1]:
2021-02-17T11:28:08.658241+00:00 app[web.1]: Starting server...
2021-02-17T11:28:09.287795+00:00 heroku[web.1]: Process exited with status 0
2021-02-17T11:28:09.381470+00:00 heroku[web.1]: State changed from starting to crashed
2021-02-17T11:29:25.813386+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=unitu-lhci.herokuapp.com request_id=9751281a-f092-4b85-ba5b-1400f19e4752 fw
d="212.164.64.134" dyno= connect= service= status=503 bytes= protocol=https
2021-02-17T11:29:26.218988+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=unitu-lhci.herokuapp.com request_id=436cd420-d751-4f92-a544-d290
9946c413 fwd="212.164.64.134" dyno= connect= service= status=503 bytes= protocol=https
@radzivil @Matsyashchik are you using node 12 in your Heroku worker? It should be the default according to their documentation and our uses of it, but apparently it seems like that's randomly not the case.
If the below fixes the issue
--- a/package.json
+++ b/package.json
@@ -6,5 +6,8 @@
"@lhci/server": "0.7.x",
"pg": "^7.12.1",
"pg-hstore": "^2.3.3"
+ },
+ "engines": {
+ "node": "12.x"
}
}
We'll add that to our docs too.
Yeah, It's finally work. @patrickhulce thank you very much!!!
I'm having some trouble setting up a Heroku server according to the documentation.
I followed the instructions, but when I run
heroku open
, I'm getting anApplication error
from Heroku.The logs look like this:
I then tried to update LHCI following the instructions.
When I did that, I realized that following the docs commits the
node_modules
directory when updating, butnode_modules
is not committed in the initial setup. Is that correct? (I have never used Heroku before, but it seems like either I should commitnode_modules
from the start, or never commit it.Next I tried to debug the app myself:
This gave me the following error:
This error message and this Stack Overflow question suggest the problem is related to SSL, but I don't know how to fix it. Any help would be much appreciated.
And if necessary, here is the build log when I updated the app: