GoogleChrome / lighthouse-ci

Automate running Lighthouse for every commit, viewing the changes, and preventing regressions
Apache License 2.0
6.39k stars 640 forks source link

Heroku server setup doesn't work #519

Closed ptmkenny closed 3 years ago

ptmkenny commented 3 years ago

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 an Application error from Heroku.

The logs look like this:

2020-12-29T13:07:20.658944+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=serene-caverns-NUMBER.herokuapp.com request_id=8e903a41-124c-433a-a440-f27e04eb8b3d fwd="220.100.124.32" dyno= connect= service= status=503 bytes= protocol=https
2020-12-29T13:07:21.002402+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=serene-caverns-NUMBER.herokuapp.com request_id=63de6f11-0bb6-4efc-af4b-1adf68cdb001 fwd="220.100.124.32" dyno= connect= service= status=503 bytes= protocol=https

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, but node_modules is not committed in the initial setup. Is that correct? (I have never used Heroku before, but it seems like either I should commit node_modules from the start, or never commit it.

Next I tried to debug the app myself:

heroku run bash
npm start

This gave me the following error:

Starting server...
(node:24) UnhandledPromiseRejectionWarning: SequelizeConnectionError: no pg_hba.conf entry for host "54.208.2.246", user "USER", database "DBID", SSL off
    at /app/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:154:24
    at Connection.connectingErrorHandler (/app/node_modules/pg/lib/client.js:194:14)
    at Connection.emit (events.js:314:20)
    at Socket.<anonymous> (/app/node_modules/pg/lib/connection.js:134:12)
    at Socket.emit (events.js:314:20)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:272:9)
    at Socket.Readable.push (_stream_readable.js:213:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
(node:24) 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)
(node:24) [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.

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:

-----> Node.js app detected

-----> Creating runtime environment

       NPM_CONFIG_LOGLEVEL=error
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       NODE_VERBOSE=false

-----> Installing binaries
       engines.node (package.json):  unspecified
       engines.npm (package.json):   unspecified (use default)

       Resolving node version 12.x...
       Downloading and installing node 12.20.0...
       Using default npm version: 6.14.8

-----> Restoring cache
       Cached directories were not restored due to a change in version of node, npm, yarn or stack
       Module installation may take longer for this build

-----> Installing dependencies
       Prebuild detected (node_modules already exists)
       Rebuilding any native modules
       @lhci/server@0.6.1 /tmp/build_51363130/node_modules/@lhci/server
       @lhci/utils@0.6.1 /tmp/build_51363130/node_modules/@lhci/utils
       isomorphic-fetch@2.2.1 /tmp/build_51363130/node_modules/isomorphic-fetch
       node-fetch@1.7.3 /tmp/build_51363130/node_modules/node-fetch
       encoding@0.1.13 /tmp/build_51363130/node_modules/encoding
       iconv-lite@0.6.2 /tmp/build_51363130/node_modules/iconv-lite
       safer-buffer@2.1.2 /tmp/build_51363130/node_modules/safer-buffer
       is-stream@1.1.0 /tmp/build_51363130/node_modules/is-stream
       whatwg-fetch@3.5.0 /tmp/build_51363130/node_modules/whatwg-fetch
       js-yaml@3.14.1 /tmp/build_51363130/node_modules/js-yaml
       argparse@1.0.10 /tmp/build_51363130/node_modules/argparse
       sprintf-js@1.0.3 /tmp/build_51363130/node_modules/sprintf-js
       esprima@4.0.1 /tmp/build_51363130/node_modules/esprima
       lighthouse@6.4.1 /tmp/build_51363130/node_modules/lighthouse
       axe-core@3.5.5 /tmp/build_51363130/node_modules/axe-core
       chrome-launcher@0.13.4 /tmp/build_51363130/node_modules/chrome-launcher
       @types/node@14.14.16 /tmp/build_51363130/node_modules/@types/node
       escape-string-regexp@1.0.5 /tmp/build_51363130/node_modules/escape-string-regexp
       is-wsl@2.2.0 /tmp/build_51363130/node_modules/is-wsl
       is-docker@2.1.1 /tmp/build_51363130/node_modules/is-docker
       lighthouse-logger@1.2.0 /tmp/build_51363130/node_modules/lighthouse-logger
       debug@2.6.9 /tmp/build_51363130/node_modules/debug
       ms@2.0.0 /tmp/build_51363130/node_modules/ms
       marky@1.2.1 /tmp/build_51363130/node_modules/marky
       mkdirp@0.5.5 /tmp/build_51363130/node_modules/mkdirp
       minimist@1.2.5 /tmp/build_51363130/node_modules/minimist
       rimraf@3.0.2 /tmp/build_51363130/node_modules/chrome-launcher/node_modules/rimraf
       glob@7.1.6 /tmp/build_51363130/node_modules/glob
       fs.realpath@1.0.0 /tmp/build_51363130/node_modules/fs.realpath
       inflight@1.0.6 /tmp/build_51363130/node_modules/inflight
       once@1.4.0 /tmp/build_51363130/node_modules/once
       wrappy@1.0.2 /tmp/build_51363130/node_modules/wrappy
       inherits@2.0.4 /tmp/build_51363130/node_modules/inherits
       minimatch@3.0.4 /tmp/build_51363130/node_modules/minimatch
       brace-expansion@1.1.11 /tmp/build_51363130/node_modules/brace-expansion
       balanced-match@1.0.0 /tmp/build_51363130/node_modules/balanced-match
       concat-map@0.0.1 /tmp/build_51363130/node_modules/concat-map
       path-is-absolute@1.0.1 /tmp/build_51363130/node_modules/path-is-absolute
       configstore@5.0.1 /tmp/build_51363130/node_modules/configstore
       dot-prop@5.3.0 /tmp/build_51363130/node_modules/dot-prop
       is-obj@2.0.0 /tmp/build_51363130/node_modules/is-obj
       graceful-fs@4.2.4 /tmp/build_51363130/node_modules/graceful-fs
       make-dir@3.1.0 /tmp/build_51363130/node_modules/make-dir
       semver@6.3.0 /tmp/build_51363130/node_modules/make-dir/node_modules/semver
       unique-string@2.0.0 /tmp/build_51363130/node_modules/unique-string
       crypto-random-string@2.0.0 /tmp/build_51363130/node_modules/crypto-random-string
       write-file-atomic@3.0.3 /tmp/build_51363130/node_modules/write-file-atomic
       imurmurhash@0.1.4 /tmp/build_51363130/node_modules/imurmurhash
       is-typedarray@1.0.0 /tmp/build_51363130/node_modules/is-typedarray
       signal-exit@3.0.3 /tmp/build_51363130/node_modules/signal-exit
       typedarray-to-buffer@3.1.5 /tmp/build_51363130/node_modules/typedarray-to-buffer
       xdg-basedir@4.0.0 /tmp/build_51363130/node_modules/xdg-basedir
       cssstyle@1.2.1 /tmp/build_51363130/node_modules/cssstyle
       cssom@0.3.8 /tmp/build_51363130/node_modules/cssom
       details-element-polyfill@2.4.0 /tmp/build_51363130/node_modules/details-element-polyfill
       http-link-header@0.8.0 /tmp/build_51363130/node_modules/http-link-header
       inquirer@7.3.3 /tmp/build_51363130/node_modules/inquirer
       ansi-escapes@4.3.1 /tmp/build_51363130/node_modules/ansi-escapes
       type-fest@0.11.0 /tmp/build_51363130/node_modules/type-fest
       chalk@4.1.0 /tmp/build_51363130/node_modules/chalk
       ansi-styles@4.3.0 /tmp/build_51363130/node_modules/ansi-styles
       color-convert@2.0.1 /tmp/build_51363130/node_modules/color-convert
       color-name@1.1.4 /tmp/build_51363130/node_modules/color-name
       supports-color@7.2.0 /tmp/build_51363130/node_modules/supports-color
       has-flag@4.0.0 /tmp/build_51363130/node_modules/has-flag
       cli-cursor@3.1.0 /tmp/build_51363130/node_modules/cli-cursor
       restore-cursor@3.1.0 /tmp/build_51363130/node_modules/restore-cursor
       onetime@5.1.2 /tmp/build_51363130/node_modules/onetime
       mimic-fn@2.1.0 /tmp/build_51363130/node_modules/mimic-fn
       cli-width@3.0.0 /tmp/build_51363130/node_modules/cli-width
       external-editor@3.1.0 /tmp/build_51363130/node_modules/external-editor
       chardet@0.7.0 /tmp/build_51363130/node_modules/chardet
       iconv-lite@0.4.24 /tmp/build_51363130/node_modules/external-editor/node_modules/iconv-lite
       tmp@0.0.33 /tmp/build_51363130/node_modules/tmp
       os-tmpdir@1.0.2 /tmp/build_51363130/node_modules/os-tmpdir
       figures@3.2.0 /tmp/build_51363130/node_modules/figures
       lodash@4.17.20 /tmp/build_51363130/node_modules/lodash
       mute-stream@0.0.8 /tmp/build_51363130/node_modules/mute-stream
       run-async@2.4.1 /tmp/build_51363130/node_modules/run-async
       rxjs@6.6.3 /tmp/build_51363130/node_modules/rxjs
       tslib@1.14.1 /tmp/build_51363130/node_modules/tslib
       string-width@4.2.0 /tmp/build_51363130/node_modules/string-width
       emoji-regex@8.0.0 /tmp/build_51363130/node_modules/emoji-regex
       is-fullwidth-code-point@3.0.0 /tmp/build_51363130/node_modules/is-fullwidth-code-point
       strip-ansi@6.0.0 /tmp/build_51363130/node_modules/strip-ansi
       ansi-regex@5.0.0 /tmp/build_51363130/node_modules/ansi-regex
       through@2.3.8 /tmp/build_51363130/node_modules/through
       intl@1.2.5 /tmp/build_51363130/node_modules/intl
       intl-messageformat@4.4.0 /tmp/build_51363130/node_modules/intl-messageformat
       intl-messageformat-parser@1.8.1 /tmp/build_51363130/node_modules/intl-messageformat-parser
       intl-pluralrules@1.2.2 /tmp/build_51363130/node_modules/intl-pluralrules
       jpeg-js@0.4.2 /tmp/build_51363130/node_modules/jpeg-js
       js-library-detector@5.9.0 /tmp/build_51363130/node_modules/js-library-detector
       jsonld@1.8.1 /tmp/build_51363130/node_modules/jsonld
       canonicalize@1.0.5 /tmp/build_51363130/node_modules/canonicalize
       rdf-canonize@1.2.0 /tmp/build_51363130/node_modules/rdf-canonize
       node-forge@0.10.0 /tmp/build_51363130/node_modules/node-forge
       semver@6.3.0 /tmp/build_51363130/node_modules/rdf-canonize/node_modules/semver
       request@2.88.2 /tmp/build_51363130/node_modules/request
       aws-sign2@0.7.0 /tmp/build_51363130/node_modules/aws-sign2
       aws4@1.11.0 /tmp/build_51363130/node_modules/aws4
       caseless@0.12.0 /tmp/build_51363130/node_modules/caseless
       combined-stream@1.0.8 /tmp/build_51363130/node_modules/combined-stream
       delayed-stream@1.0.0 /tmp/build_51363130/node_modules/delayed-stream
       extend@3.0.2 /tmp/build_51363130/node_modules/extend
       forever-agent@0.6.1 /tmp/build_51363130/node_modules/forever-agent
       form-data@2.3.3 /tmp/build_51363130/node_modules/form-data
       asynckit@0.4.0 /tmp/build_51363130/node_modules/asynckit
       mime-types@2.1.27 /tmp/build_51363130/node_modules/mime-types
       mime-db@1.44.0 /tmp/build_51363130/node_modules/mime-db
       har-validator@5.1.5 /tmp/build_51363130/node_modules/har-validator
       ajv@6.12.6 /tmp/build_51363130/node_modules/ajv
       fast-deep-equal@3.1.3 /tmp/build_51363130/node_modules/fast-deep-equal
       fast-json-stable-stringify@2.1.0 /tmp/build_51363130/node_modules/fast-json-stable-stringify
       json-schema-traverse@0.4.1 /tmp/build_51363130/node_modules/json-schema-traverse
       uri-js@4.4.0 /tmp/build_51363130/node_modules/uri-js
       punycode@2.1.1 /tmp/build_51363130/node_modules/punycode
       har-schema@2.0.0 /tmp/build_51363130/node_modules/har-schema
       http-signature@1.2.0 /tmp/build_51363130/node_modules/http-signature
       assert-plus@1.0.0 /tmp/build_51363130/node_modules/assert-plus
       jsprim@1.4.1 /tmp/build_51363130/node_modules/jsprim
       extsprintf@1.3.0 /tmp/build_51363130/node_modules/extsprintf
       json-schema@0.2.3 /tmp/build_51363130/node_modules/json-schema
       verror@1.10.0 /tmp/build_51363130/node_modules/verror
       core-util-is@1.0.2 /tmp/build_51363130/node_modules/core-util-is
       sshpk@1.16.1 /tmp/build_51363130/node_modules/sshpk
       asn1@0.2.4 /tmp/build_51363130/node_modules/asn1
       bcrypt-pbkdf@1.0.2 /tmp/build_51363130/node_modules/bcrypt-pbkdf
       tweetnacl@0.14.5 /tmp/build_51363130/node_modules/tweetnacl
       dashdash@1.14.1 /tmp/build_51363130/node_modules/dashdash
       ecc-jsbn@0.1.2 /tmp/build_51363130/node_modules/ecc-jsbn
       jsbn@0.1.1 /tmp/build_51363130/node_modules/jsbn
       getpass@0.1.7 /tmp/build_51363130/node_modules/getpass
       isstream@0.1.2 /tmp/build_51363130/node_modules/isstream
       json-stringify-safe@5.0.1 /tmp/build_51363130/node_modules/json-stringify-safe
       oauth-sign@0.9.0 /tmp/build_51363130/node_modules/oauth-sign
       performance-now@2.1.0 /tmp/build_51363130/node_modules/performance-now
       qs@6.5.2 /tmp/build_51363130/node_modules/qs
       safe-buffer@5.2.1 /tmp/build_51363130/node_modules/safe-buffer
       tough-cookie@2.5.0 /tmp/build_51363130/node_modules/tough-cookie
       psl@1.8.0 /tmp/build_51363130/node_modules/psl
       tunnel-agent@0.6.0 /tmp/build_51363130/node_modules/tunnel-agent
       uuid@3.4.0 /tmp/build_51363130/node_modules/uuid
       semver@5.7.1 /tmp/build_51363130/node_modules/semver
       xmldom@0.1.19 /tmp/build_51363130/node_modules/xmldom
       jsonlint-mod@1.7.6 /tmp/build_51363130/node_modules/jsonlint-mod
       JSV@4.0.2 /tmp/build_51363130/node_modules/JSV
       chalk@2.4.2 /tmp/build_51363130/node_modules/jsonlint-mod/node_modules/chalk
       ansi-styles@3.2.1 /tmp/build_51363130/node_modules/jsonlint-mod/node_modules/ansi-styles
       color-convert@1.9.3 /tmp/build_51363130/node_modules/jsonlint-mod/node_modules/color-convert
       color-name@1.1.3 /tmp/build_51363130/node_modules/jsonlint-mod/node_modules/color-name
       supports-color@5.5.0 /tmp/build_51363130/node_modules/jsonlint-mod/node_modules/supports-color
       has-flag@3.0.0 /tmp/build_51363130/node_modules/jsonlint-mod/node_modules/has-flag
       underscore@1.12.0 /tmp/build_51363130/node_modules/underscore
       lighthouse-stack-packs@1.4.0 /tmp/build_51363130/node_modules/lighthouse-stack-packs
       lodash.get@4.4.2 /tmp/build_51363130/node_modules/lodash.get
       lodash.isequal@4.5.0 /tmp/build_51363130/node_modules/lodash.isequal
       lodash.set@4.3.2 /tmp/build_51363130/node_modules/lodash.set
       lookup-closest-locale@6.0.4 /tmp/build_51363130/node_modules/lookup-closest-locale
       metaviewport-parser@0.2.0 /tmp/build_51363130/node_modules/metaviewport-parser
       open@6.4.0 /tmp/build_51363130/node_modules/open
       is-wsl@1.1.0 /tmp/build_51363130/node_modules/open/node_modules/is-wsl
       parse-cache-control@1.0.1 /tmp/build_51363130/node_modules/parse-cache-control
       ps-list@7.2.0 /tmp/build_51363130/node_modules/ps-list
       raven@2.6.4 /tmp/build_51363130/node_modules/raven
       cookie@0.3.1 /tmp/build_51363130/node_modules/cookie
       md5@2.3.0 /tmp/build_51363130/node_modules/md5
       charenc@0.0.2 /tmp/build_51363130/node_modules/charenc
       crypt@0.0.2 /tmp/build_51363130/node_modules/crypt
       is-buffer@1.1.6 /tmp/build_51363130/node_modules/is-buffer
       stack-trace@0.0.10 /tmp/build_51363130/node_modules/stack-trace
       timed-out@4.0.1 /tmp/build_51363130/node_modules/timed-out
       uuid@3.3.2 /tmp/build_51363130/node_modules/raven/node_modules/uuid
       rimraf@2.7.1 /tmp/build_51363130/node_modules/rimraf
       robots-parser@2.1.1 /tmp/build_51363130/node_modules/robots-parser
       speedline-core@1.4.3 /tmp/build_51363130/node_modules/speedline-core
       image-ssim@0.2.0 /tmp/build_51363130/node_modules/image-ssim
       third-party-web@0.12.3 /tmp/build_51363130/node_modules/third-party-web
       update-notifier@4.1.3 /tmp/build_51363130/node_modules/update-notifier
       boxen@4.2.0 /tmp/build_51363130/node_modules/boxen
       ansi-align@3.0.0 /tmp/build_51363130/node_modules/ansi-align
       string-width@3.1.0 /tmp/build_51363130/node_modules/ansi-align/node_modules/string-width
       emoji-regex@7.0.3 /tmp/build_51363130/node_modules/ansi-align/node_modules/emoji-regex
       is-fullwidth-code-point@2.0.0 /tmp/build_51363130/node_modules/ansi-align/node_modules/is-fullwidth-code-point
       strip-ansi@5.2.0 /tmp/build_51363130/node_modules/ansi-align/node_modules/strip-ansi
       ansi-regex@4.1.0 /tmp/build_51363130/node_modules/ansi-align/node_modules/ansi-regex
       camelcase@5.3.1 /tmp/build_51363130/node_modules/camelcase
       chalk@3.0.0 /tmp/build_51363130/node_modules/boxen/node_modules/chalk
       cli-boxes@2.2.1 /tmp/build_51363130/node_modules/cli-boxes
       term-size@2.2.1 /tmp/build_51363130/node_modules/term-size
       type-fest@0.8.1 /tmp/build_51363130/node_modules/boxen/node_modules/type-fest
       widest-line@3.1.0 /tmp/build_51363130/node_modules/widest-line
       chalk@3.0.0 /tmp/build_51363130/node_modules/update-notifier/node_modules/chalk
       has-yarn@2.1.0 /tmp/build_51363130/node_modules/has-yarn
       import-lazy@2.1.0 /tmp/build_51363130/node_modules/import-lazy
       is-ci@2.0.0 /tmp/build_51363130/node_modules/is-ci
       ci-info@2.0.0 /tmp/build_51363130/node_modules/ci-info
       is-installed-globally@0.3.2 /tmp/build_51363130/node_modules/is-installed-globally
       global-dirs@2.1.0 /tmp/build_51363130/node_modules/global-dirs
       ini@1.3.7 /tmp/build_51363130/node_modules/ini
       is-path-inside@3.0.2 /tmp/build_51363130/node_modules/is-path-inside
       is-npm@4.0.0 /tmp/build_51363130/node_modules/is-npm
       is-yarn-global@0.3.0 /tmp/build_51363130/node_modules/is-yarn-global
       latest-version@5.1.0 /tmp/build_51363130/node_modules/latest-version
       package-json@6.5.0 /tmp/build_51363130/node_modules/package-json
       got@9.6.0 /tmp/build_51363130/node_modules/got
       @sindresorhus/is@0.14.0 /tmp/build_51363130/node_modules/@sindresorhus/is
       @szmarczak/http-timer@1.1.2 /tmp/build_51363130/node_modules/@szmarczak/http-timer
       defer-to-connect@1.1.3 /tmp/build_51363130/node_modules/defer-to-connect
       cacheable-request@6.1.0 /tmp/build_51363130/node_modules/cacheable-request
       clone-response@1.0.2 /tmp/build_51363130/node_modules/clone-response
       mimic-response@1.0.1 /tmp/build_51363130/node_modules/mimic-response
       get-stream@5.2.0 /tmp/build_51363130/node_modules/cacheable-request/node_modules/get-stream
       pump@3.0.0 /tmp/build_51363130/node_modules/pump
       end-of-stream@1.4.4 /tmp/build_51363130/node_modules/end-of-stream
       http-cache-semantics@4.1.0 /tmp/build_51363130/node_modules/http-cache-semantics
       keyv@3.1.0 /tmp/build_51363130/node_modules/keyv
       json-buffer@3.0.0 /tmp/build_51363130/node_modules/json-buffer
       lowercase-keys@2.0.0 /tmp/build_51363130/node_modules/cacheable-request/node_modules/lowercase-keys
       normalize-url@4.5.0 /tmp/build_51363130/node_modules/normalize-url
       responselike@1.0.2 /tmp/build_51363130/node_modules/responselike
       lowercase-keys@1.0.1 /tmp/build_51363130/node_modules/lowercase-keys
       decompress-response@3.3.0 /tmp/build_51363130/node_modules/decompress-response
       duplexer3@0.1.4 /tmp/build_51363130/node_modules/duplexer3
       get-stream@4.1.0 /tmp/build_51363130/node_modules/get-stream
       p-cancelable@1.1.0 /tmp/build_51363130/node_modules/p-cancelable
       to-readable-stream@1.0.0 /tmp/build_51363130/node_modules/to-readable-stream
       url-parse-lax@3.0.0 /tmp/build_51363130/node_modules/url-parse-lax
       prepend-http@2.0.0 /tmp/build_51363130/node_modules/prepend-http
       registry-auth-token@4.2.1 /tmp/build_51363130/node_modules/registry-auth-token
       rc@1.2.8 /tmp/build_51363130/node_modules/rc
       deep-extend@0.6.0 /tmp/build_51363130/node_modules/deep-extend
       strip-json-comments@2.0.1 /tmp/build_51363130/node_modules/strip-json-comments
       registry-url@5.1.0 /tmp/build_51363130/node_modules/registry-url
       semver@6.3.0 /tmp/build_51363130/node_modules/package-json/node_modules/semver
       pupa@2.1.1 /tmp/build_51363130/node_modules/pupa
       escape-goat@2.1.1 /tmp/build_51363130/node_modules/escape-goat
       semver-diff@3.1.1 /tmp/build_51363130/node_modules/semver-diff
       semver@6.3.0 /tmp/build_51363130/node_modules/semver-diff/node_modules/semver
       ws@3.3.2 /tmp/build_51363130/node_modules/ws
       async-limiter@1.0.1 /tmp/build_51363130/node_modules/async-limiter
       safe-buffer@5.1.2 /tmp/build_51363130/node_modules/ws/node_modules/safe-buffer
       ultron@1.1.1 /tmp/build_51363130/node_modules/ultron
       yargs@3.32.0 /tmp/build_51363130/node_modules/yargs
       camelcase@2.1.1 /tmp/build_51363130/node_modules/yargs/node_modules/camelcase
       cliui@3.2.0 /tmp/build_51363130/node_modules/cliui
       string-width@1.0.2 /tmp/build_51363130/node_modules/cliui/node_modules/string-width
       code-point-at@1.1.0 /tmp/build_51363130/node_modules/code-point-at
       is-fullwidth-code-point@1.0.0 /tmp/build_51363130/node_modules/cliui/node_modules/is-fullwidth-code-point
       number-is-nan@1.0.1 /tmp/build_51363130/node_modules/number-is-nan
       strip-ansi@3.0.1 /tmp/build_51363130/node_modules/cliui/node_modules/strip-ansi
       ansi-regex@2.1.1 /tmp/build_51363130/node_modules/cliui/node_modules/ansi-regex
       wrap-ansi@2.1.0 /tmp/build_51363130/node_modules/wrap-ansi
       string-width@1.0.2 /tmp/build_51363130/node_modules/wrap-ansi/node_modules/string-width
       is-fullwidth-code-point@1.0.0 /tmp/build_51363130/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point
       strip-ansi@3.0.1 /tmp/build_51363130/node_modules/wrap-ansi/node_modules/strip-ansi
       ansi-regex@2.1.1 /tmp/build_51363130/node_modules/wrap-ansi/node_modules/ansi-regex
       decamelize@1.2.0 /tmp/build_51363130/node_modules/decamelize
       os-locale@1.4.0 /tmp/build_51363130/node_modules/os-locale
       lcid@1.0.0 /tmp/build_51363130/node_modules/lcid
       invert-kv@1.0.0 /tmp/build_51363130/node_modules/invert-kv
       string-width@1.0.2 /tmp/build_51363130/node_modules/yargs/node_modules/string-width
       is-fullwidth-code-point@1.0.0 /tmp/build_51363130/node_modules/yargs/node_modules/is-fullwidth-code-point
       strip-ansi@3.0.1 /tmp/build_51363130/node_modules/yargs/node_modules/strip-ansi
       ansi-regex@2.1.1 /tmp/build_51363130/node_modules/yargs/node_modules/ansi-regex
       window-size@0.1.4 /tmp/build_51363130/node_modules/window-size
       y18n@3.2.1 /tmp/build_51363130/node_modules/y18n
       yargs-parser@18.1.3 /tmp/build_51363130/node_modules/yargs-parser
       tree-kill@1.2.2 /tmp/build_51363130/node_modules/tree-kill
       body-parser@1.19.0 /tmp/build_51363130/node_modules/body-parser
       bytes@3.1.0 /tmp/build_51363130/node_modules/bytes
       content-type@1.0.4 /tmp/build_51363130/node_modules/content-type
       depd@1.1.2 /tmp/build_51363130/node_modules/depd
       http-errors@1.7.2 /tmp/build_51363130/node_modules/http-errors
       inherits@2.0.3 /tmp/build_51363130/node_modules/http-errors/node_modules/inherits
       setprototypeof@1.1.1 /tmp/build_51363130/node_modules/setprototypeof
       statuses@1.5.0 /tmp/build_51363130/node_modules/statuses
       toidentifier@1.0.0 /tmp/build_51363130/node_modules/toidentifier
       iconv-lite@0.4.24 /tmp/build_51363130/node_modules/body-parser/node_modules/iconv-lite
       on-finished@2.3.0 /tmp/build_51363130/node_modules/on-finished
       ee-first@1.1.1 /tmp/build_51363130/node_modules/ee-first
       qs@6.7.0 /tmp/build_51363130/node_modules/body-parser/node_modules/qs
       raw-body@2.4.0 /tmp/build_51363130/node_modules/raw-body
       iconv-lite@0.4.24 /tmp/build_51363130/node_modules/raw-body/node_modules/iconv-lite
       unpipe@1.0.0 /tmp/build_51363130/node_modules/unpipe
       type-is@1.6.18 /tmp/build_51363130/node_modules/type-is
       media-typer@0.3.0 /tmp/build_51363130/node_modules/media-typer
       compression@1.7.4 /tmp/build_51363130/node_modules/compression
       accepts@1.3.7 /tmp/build_51363130/node_modules/accepts
       negotiator@0.6.2 /tmp/build_51363130/node_modules/negotiator
       bytes@3.0.0 /tmp/build_51363130/node_modules/compression/node_modules/bytes
       compressible@2.0.18 /tmp/build_51363130/node_modules/compressible
       on-headers@1.0.2 /tmp/build_51363130/node_modules/on-headers
       safe-buffer@5.1.2 /tmp/build_51363130/node_modules/compression/node_modules/safe-buffer
       vary@1.1.2 /tmp/build_51363130/node_modules/vary
       cron@1.8.2 /tmp/build_51363130/node_modules/cron
       moment-timezone@0.5.32 /tmp/build_51363130/node_modules/moment-timezone
       moment@2.29.1 /tmp/build_51363130/node_modules/moment
       dayjs@1.9.8 /tmp/build_51363130/node_modules/dayjs
       express@4.17.1 /tmp/build_51363130/node_modules/express
       array-flatten@1.1.1 /tmp/build_51363130/node_modules/array-flatten
       content-disposition@0.5.3 /tmp/build_51363130/node_modules/content-disposition
       safe-buffer@5.1.2 /tmp/build_51363130/node_modules/content-disposition/node_modules/safe-buffer
       cookie@0.4.0 /tmp/build_51363130/node_modules/express/node_modules/cookie
       cookie-signature@1.0.6 /tmp/build_51363130/node_modules/cookie-signature
       encodeurl@1.0.2 /tmp/build_51363130/node_modules/encodeurl
       escape-html@1.0.3 /tmp/build_51363130/node_modules/escape-html
       etag@1.8.1 /tmp/build_51363130/node_modules/etag
       finalhandler@1.1.2 /tmp/build_51363130/node_modules/finalhandler
       parseurl@1.3.3 /tmp/build_51363130/node_modules/parseurl
       fresh@0.5.2 /tmp/build_51363130/node_modules/fresh
       merge-descriptors@1.0.1 /tmp/build_51363130/node_modules/merge-descriptors
       methods@1.1.2 /tmp/build_51363130/node_modules/methods
       path-to-regexp@0.1.7 /tmp/build_51363130/node_modules/path-to-regexp
       proxy-addr@2.0.6 /tmp/build_51363130/node_modules/proxy-addr
       forwarded@0.1.2 /tmp/build_51363130/node_modules/forwarded
       ipaddr.js@1.9.1 /tmp/build_51363130/node_modules/ipaddr.js
       qs@6.7.0 /tmp/build_51363130/node_modules/express/node_modules/qs
       range-parser@1.2.1 /tmp/build_51363130/node_modules/range-parser
       safe-buffer@5.1.2 /tmp/build_51363130/node_modules/express/node_modules/safe-buffer
       send@0.17.1 /tmp/build_51363130/node_modules/send
       destroy@1.0.4 /tmp/build_51363130/node_modules/destroy
       mime@1.6.0 /tmp/build_51363130/node_modules/mime
       ms@2.1.1 /tmp/build_51363130/node_modules/send/node_modules/ms
       serve-static@1.14.1 /tmp/build_51363130/node_modules/serve-static
       utils-merge@1.0.1 /tmp/build_51363130/node_modules/utils-merge
       express-basic-auth@1.2.0 /tmp/build_51363130/node_modules/express-basic-auth
       basic-auth@2.0.1 /tmp/build_51363130/node_modules/basic-auth
       safe-buffer@5.1.2 /tmp/build_51363130/node_modules/basic-auth/node_modules/safe-buffer
       morgan@1.10.0 /tmp/build_51363130/node_modules/morgan
       depd@2.0.0 /tmp/build_51363130/node_modules/morgan/node_modules/depd
       sequelize@4.44.4 /tmp/build_51363130/node_modules/sequelize
       bluebird@3.7.2 /tmp/build_51363130/node_modules/bluebird
       cls-bluebird@2.1.0 /tmp/build_51363130/node_modules/cls-bluebird
       is-bluebird@1.0.2 /tmp/build_51363130/node_modules/is-bluebird
       shimmer@1.2.1 /tmp/build_51363130/node_modules/shimmer
       debug@3.2.7 /tmp/build_51363130/node_modules/sequelize/node_modules/debug
       ms@2.1.3 /tmp/build_51363130/node_modules/sequelize/node_modules/ms
       dottie@2.0.2 /tmp/build_51363130/node_modules/dottie
       generic-pool@3.5.0 /tmp/build_51363130/node_modules/generic-pool
       inflection@1.12.0 /tmp/build_51363130/node_modules/inflection
       retry-as-promised@2.3.2 /tmp/build_51363130/node_modules/retry-as-promised
       terraformer-wkt-parser@1.2.1 /tmp/build_51363130/node_modules/terraformer-wkt-parser
       @types/geojson@1.0.6 /tmp/build_51363130/node_modules/@types/geojson
       terraformer@1.0.12 /tmp/build_51363130/node_modules/terraformer
       toposort-class@1.0.1 /tmp/build_51363130/node_modules/toposort-class
       validator@10.11.0 /tmp/build_51363130/node_modules/validator
       wkx@0.4.8 /tmp/build_51363130/node_modules/wkx
       umzug@2.3.0 /tmp/build_51363130/node_modules/umzug
       Installing any new modules (package.json)
       added 20 packages from 11 contributors and audited 369 packages in 3.67s

       20 packages are looking for funding
         run `npm fund` for details

       found 1 low severity vulnerability
         run `npm audit fix` to fix them, or `npm audit` for details

-----> Build

-----> Caching build
       - node_modules

-----> Pruning devDependencies
       audited 369 packages in 2.752s

       20 packages are looking for funding
         run `npm fund` for details

       found 1 low severity vulnerability
         run `npm audit fix` to fix them, or `npm audit` for details

-----> Build succeeded!
-----> Discovering process types
       Procfile declares types     -> (none)
       Default types for buildpack -> web
-----> Compressing...
       Done: 43.8M
-----> Launching...
       Released v6
       https://serene-caverns-MYNUMBER.herokuapp.com/ deployed to Heroku
patrickhulce commented 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?

ptmkenny commented 3 years ago

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
patrickhulce commented 3 years ago

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

ryan-ludwig commented 3 years ago

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 ...

anton-karlovskiy commented 3 years ago

Hi @patrickhulce

I've also run into this issue. image Could you please help with it? Thank you.

cc @addyosmani

patrickhulce commented 3 years ago

Alright something has clearly changed with heroku account setup since the docs were written then. We'll look into when we get the chance.

patrickhulce commented 3 years ago

@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?

anton-karlovskiy commented 3 years ago

@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: logs

I'm wondering if it's related to https://github.com/sequelize/sequelize/issues/956.

anton-karlovskiy commented 3 years ago

@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

patrickhulce commented 3 years ago

@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?

anton-karlovskiy commented 3 years ago

@patrickhulce

Thank you for your reply. Let me try and update you shortly.

anton-karlovskiy commented 3 years ago

@patrickhulce

WOW! It's working. Thank you very much for your help.

cc @addyosmani

patrickhulce commented 3 years ago

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 👍

victor-pogor commented 3 years ago

@patrickhulce it works 🥳. Thanks!

domharrington commented 3 years ago

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

patrickhulce commented 3 years ago

docs were updated in 0f5c2ddbc7faedaaf32b5dc8c83678776636460e thanks for your patience trying fixes til we figured it out everyone! 🎉

radzivil commented 3 years ago

tried to set it up today using the latest instruction provided and still face the same problem as author of this issue

patrickhulce commented 3 years ago

@radzivil specifically your server.js file contains the line inside the storage property found here?

https://github.com/GoogleChrome/lighthouse-ci/blob/0f5c2ddbc7faedaaf32b5dc8c83678776636460e/docs/recipes/heroku-server/server.js#L17

radzivil commented 3 years ago

@patrickhulce yes, sqlDialectOptions: {ssl: true} option is set. However, result is the same

patrickhulce commented 3 years ago

Can you share the exact log messages produced and exact config used?

radzivil commented 3 years ago
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));
patrickhulce commented 3 years ago

@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.

Matsyashchik commented 3 years ago

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

patrickhulce commented 3 years ago

@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.

Matsyashchik commented 3 years ago

Yeah, It's finally work. @patrickhulce thank you very much!!!