Kyle Lambert
Kyle Lambert

Reputation: 389

Heroku Application Error when deploying Strapi CMS with Postgres

I've been trying to deploy my Stapi CMS to Heroku but I keep getting an error. It builds successfully and deploys but when I visit the URL it just displays Application Error.

Here's the build logs:

-----> 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):  >=10.0.0
       engines.npm (package.json):   >=6.0.0
       
       Resolving node version >=10.0.0...
       Downloading and installing node 15.3.0...
       Bootstrapping npm >=6.0.0 (replacing 7.0.14)...
       npm >=6.0.0 installed
       
-----> Installing dependencies
       Installing node modules
       
       > @fortawesome/[email protected] postinstall /tmp/build_df2cd10e/node_modules/@fortawesome/fontawesome-common-types
       > node attribution.js
       
       Font Awesome Free 0.2.32 by @fontawesome - https://fontawesome.com
       License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
       
       
       > @fortawesome/[email protected] postinstall /tmp/build_df2cd10e/node_modules/@fortawesome/free-solid-svg-icons
       > node attribution.js
       
       Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
       License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
       
       
       > @fortawesome/[email protected] postinstall /tmp/build_df2cd10e/node_modules/@fortawesome/free-regular-svg-icons
       > node attribution.js
       
       Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
       License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
       
       
       > @fortawesome/[email protected] postinstall /tmp/build_df2cd10e/node_modules/@fortawesome/fontawesome-svg-core
       > node attribution.js
       
       Font Awesome Free 1.2.32 by @fontawesome - https://fontawesome.com
       License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
       
       
       > @fortawesome/[email protected] postinstall /tmp/build_df2cd10e/node_modules/@fortawesome/fontawesome-free
       > node attribution.js
       
       Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
       License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
       
       
       > [email protected] install /tmp/build_df2cd10e/node_modules/sharp
       > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
       
       info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.10.0/libvips-8.10.0-linux-x64.tar.br
       
       > [email protected] postinstall /tmp/build_df2cd10e/node_modules/fbjs/node_modules/core-js
       > node -e "try{require('./postinstall')}catch(e){}"
       
       
       > [email protected] install /tmp/build_df2cd10e/node_modules/webpack-dev-server/node_modules/fsevents
       > node install.js
       
       
       Skipping 'fsevents' build as platform linux is not supported
       
       > [email protected] install /tmp/build_df2cd10e/node_modules/watchpack-chokidar2/node_modules/fsevents
       > node install.js
       
       
       Skipping 'fsevents' build as platform linux is not supported
       
       > @fortawesome/[email protected] postinstall /tmp/build_df2cd10e/node_modules/@fortawesome/free-brands-svg-icons
       > node attribution.js
       
       Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
       License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
       
       
       > [email protected] postinstall /tmp/build_df2cd10e/node_modules/core-js
       > node -e "try{require('./postinstall')}catch(e){}"
       
       
       > [email protected] postinstall /tmp/build_df2cd10e/node_modules/strapi
       > node lib/utils/success.js
       
       
       > [email protected] install /tmp/build_df2cd10e/node_modules/sqlite3
       > node-pre-gyp install --fallback-to-build
       
       [sqlite3] Success: "/tmp/build_df2cd10e/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.node" is installed via remote
       added 1562 packages in 39.888s
       
-----> Build
       Running build
       
       > [email protected] build /tmp/build_df2cd10e
       > strapi build
       
       Building your admin UI with production configuration ...
       ℹ Compiling Webpack
       ✔ Webpack: Compiled successfully in 1.53m
       
-----> Caching build
       - node_modules
       
-----> Pruning devDependencies
       removed 22 packages and audited 1542 packages in 11.993s
       
       70 packages are looking for funding
         run `npm fund` for details
       
       found 0 vulnerabilities
       
       
-----> Build succeeded!
-----> Discovering process types
       Procfile declares types     -> (none)
       Default types for buildpack -> web
-----> Compressing...
       Done: 149.6M
-----> Launching...
       Released v6
       https://ghost-lifestyle-ecommerce.herokuapp.com/ deployed to Heroku

And the error logs:

2020-11-29T10:19:03.786723+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-11-29T10:19:03.796351+00:00 app[web.1]: 
2020-11-29T10:19:03.796542+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-11-29T10:19:03.796694+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2020-11-29T10_19_03_788Z-debug.log
2020-11-29T10:19:03.847200+00:00 heroku[web.1]: Process exited with status 1
2020-11-29T10:19:03.886169+00:00 heroku[web.1]: State changed from starting to crashed
2020-11-29T10:19:03.890353+00:00 heroku[web.1]: State changed from crashed to starting
2020-11-29T10:19:08.000000+00:00 app[api]: Build succeeded
2020-11-29T10:19:26.024886+00:00 heroku[web.1]: Starting process with command `npm start`
2020-11-29T10:19:29.057541+00:00 app[web.1]: 
2020-11-29T10:19:29.057564+00:00 app[web.1]: > [email protected] start /app
2020-11-29T10:19:29.057564+00:00 app[web.1]: > strapi start
2020-11-29T10:19:29.057565+00:00 app[web.1]: 
2020-11-29T10:19:32.771015+00:00 app[web.1]: [2020-11-29T10:19:32.770Z] debug ⛔️ Server wasn't able to start properly.
2020-11-29T10:19:32.773653+00:00 app[web.1]: [2020-11-29T10:19:32.773Z] error error: null value in column "id" violates not-null constraint
2020-11-29T10:19:32.773655+00:00 app[web.1]: at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:278:15)
2020-11-29T10:19:32.773655+00:00 app[web.1]: at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
2020-11-29T10:19:32.773656+00:00 app[web.1]: at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
2020-11-29T10:19:32.773656+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:10:42)
2020-11-29T10:19:32.773659+00:00 app[web.1]: at Socket.emit (node:events:376:20)
2020-11-29T10:19:32.773660+00:00 app[web.1]: at addChunk (node:internal/streams/readable:304:12)
2020-11-29T10:19:32.773661+00:00 app[web.1]: at readableAddChunk (node:internal/streams/readable:279:9)
2020-11-29T10:19:32.773661+00:00 app[web.1]: at Socket.Readable.push (node:internal/streams/readable:218:10)
2020-11-29T10:19:32.773661+00:00 app[web.1]: at TCP.onStreamRead (node:internal/stream_base_commons:192:23)
2020-11-29T10:19:32.795758+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-11-29T10:19:32.796257+00:00 app[web.1]: npm ERR! errno 1
2020-11-29T10:19:32.803913+00:00 app[web.1]: npm ERR! [email protected] start: `strapi start`
2020-11-29T10:19:32.804152+00:00 app[web.1]: npm ERR! Exit status 1
2020-11-29T10:19:32.804381+00:00 app[web.1]: npm ERR!
2020-11-29T10:19:32.804585+00:00 app[web.1]: npm ERR! Failed at the [email protected] start script.
2020-11-29T10:19:32.804756+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-11-29T10:19:32.811241+00:00 app[web.1]: 
2020-11-29T10:19:32.811477+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-11-29T10:19:32.811622+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2020-11-29T10_19_32_805Z-debug.log
2020-11-29T10:19:32.874877+00:00 heroku[web.1]: Process exited with status 1
2020-11-29T10:19:32.917828+00:00 heroku[web.1]: State changed from starting to crashed
2020-11-29T10:19:53.991477+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ghost-lifestyle-ecommerce.herokuapp.com request_id=69f1a34f-9429-4f0b-bdf8-ddddf59a5f77 fwd="101.174.44.54" dyno= connect= service= status=503 bytes= protocol=https
2020-11-29T10:19:54.458022+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ghost-lifestyle-ecommerce.herokuapp.com request_id=6c735d09-ceaf-489f-95dc-ba363dfd4445 fwd="101.174.44.54" dyno= connect= service= status=503 bytes= protocol=https
2020-11-29T10:36:05.826739+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ghost-lifestyle-ecommerce.herokuapp.com request_id=bd172ddf-258a-411e-afbb-4f2c0c3c7898 fwd="101.174.44.54" dyno= connect= service= status=503 bytes= protocol=https
2020-11-29T10:36:06.195989+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ghost-lifestyle-ecommerce.herokuapp.com request_id=0b0acc34-0713-4050-8b9a-3c0f89f824a8 fwd="101.174.44.54" dyno= connect= service= status=503 bytes= protocol=https
2020-11-29T10:44:26.490521+00:00 heroku[web.1]: State changed from crashed to starting
2020-11-29T10:44:43.033805+00:00 heroku[web.1]: Starting process with command `npm start`
2020-11-29T10:44:45.678896+00:00 app[web.1]: 
2020-11-29T10:44:45.678910+00:00 app[web.1]: > [email protected] start /app
2020-11-29T10:44:45.678911+00:00 app[web.1]: > strapi start
2020-11-29T10:44:45.678911+00:00 app[web.1]: 
2020-11-29T10:44:48.252950+00:00 app[web.1]: [2020-11-29T10:44:48.252Z] debug ⛔️ Server wasn't able to start properly.
2020-11-29T10:44:48.254087+00:00 app[web.1]: [2020-11-29T10:44:48.254Z] error error: null value in column "id" violates not-null constraint
2020-11-29T10:44:48.254088+00:00 app[web.1]: at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:278:15)
2020-11-29T10:44:48.254088+00:00 app[web.1]: at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
2020-11-29T10:44:48.254089+00:00 app[web.1]: at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
2020-11-29T10:44:48.254090+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:10:42)
2020-11-29T10:44:48.254090+00:00 app[web.1]: at Socket.emit (node:events:376:20)
2020-11-29T10:44:48.254091+00:00 app[web.1]: at addChunk (node:internal/streams/readable:304:12)
2020-11-29T10:44:48.254092+00:00 app[web.1]: at readableAddChunk (node:internal/streams/readable:279:9)
2020-11-29T10:44:48.254092+00:00 app[web.1]: at Socket.Readable.push (node:internal/streams/readable:218:10)
2020-11-29T10:44:48.254093+00:00 app[web.1]: at TCP.onStreamRead (node:internal/stream_base_commons:192:23)
2020-11-29T10:44:48.269283+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-11-29T10:44:48.269565+00:00 app[web.1]: npm ERR! errno 1
2020-11-29T10:44:48.273987+00:00 app[web.1]: npm ERR! [email protected] start: `strapi start`
2020-11-29T10:44:48.274132+00:00 app[web.1]: npm ERR! Exit status 1
2020-11-29T10:44:48.274294+00:00 app[web.1]: npm ERR!
2020-11-29T10:44:48.274491+00:00 app[web.1]: npm ERR! Failed at the [email protected] start script.
2020-11-29T10:44:48.274520+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-11-29T10:44:48.283421+00:00 app[web.1]: 
2020-11-29T10:44:48.283572+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-11-29T10:44:48.283639+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2020-11-29T10_44_48_275Z-debug.log
2020-11-29T10:44:48.326804+00:00 heroku[web.1]: Process exited with status 1
2020-11-29T10:44:48.366865+00:00 heroku[web.1]: State changed from starting to crashed
2020-11-29T10:50:41.286347+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ghost-lifestyle-ecommerce.herokuapp.com request_id=c118bb50-72c2-4946-82d1-1ac85cf4faed fwd="101.174.44.54" dyno= connect= service= status=503 bytes= protocol=https
2020-11-29T10:50:41.661063+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ghost-lifestyle-ecommerce.herokuapp.com request_id=497bb654-a07e-49a6-8863-88c80ca41a27 fwd="101.174.44.54" dyno= connect= service= status=503 bytes= protocol=https
2020-11-29T11:39:39.766921+00:00 heroku[web.1]: State changed from crashed to starting
2020-11-29T11:39:57.294612+00:00 heroku[web.1]: Starting process with command `npm start`
2020-11-29T11:39:59.486582+00:00 app[web.1]: 
2020-11-29T11:39:59.486597+00:00 app[web.1]: > [email protected] start /app
2020-11-29T11:39:59.486598+00:00 app[web.1]: > strapi start
2020-11-29T11:39:59.486598+00:00 app[web.1]: 
2020-11-29T11:40:02.480742+00:00 app[web.1]: [2020-11-29T11:40:02.480Z] debug ⛔️ Server wasn't able to start properly.
2020-11-29T11:40:02.482309+00:00 app[web.1]: [2020-11-29T11:40:02.482Z] error error: null value in column "id" violates not-null constraint
2020-11-29T11:40:02.482310+00:00 app[web.1]: at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:278:15)
2020-11-29T11:40:02.482310+00:00 app[web.1]: at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
2020-11-29T11:40:02.482310+00:00 app[web.1]: at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
2020-11-29T11:40:02.482311+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:10:42)
2020-11-29T11:40:02.482312+00:00 app[web.1]: at Socket.emit (node:events:376:20)
2020-11-29T11:40:02.482313+00:00 app[web.1]: at addChunk (node:internal/streams/readable:304:12)
2020-11-29T11:40:02.482313+00:00 app[web.1]: at readableAddChunk (node:internal/streams/readable:279:9)
2020-11-29T11:40:02.482313+00:00 app[web.1]: at Socket.Readable.push (node:internal/streams/readable:218:10)
2020-11-29T11:40:02.482314+00:00 app[web.1]: at TCP.onStreamRead (node:internal/stream_base_commons:192:23)
2020-11-29T11:40:02.506521+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-11-29T11:40:02.506936+00:00 app[web.1]: npm ERR! errno 1
2020-11-29T11:40:02.513481+00:00 app[web.1]: npm ERR! [email protected] start: `strapi start`
2020-11-29T11:40:02.513624+00:00 app[web.1]: npm ERR! Exit status 1
2020-11-29T11:40:02.513780+00:00 app[web.1]: npm ERR!
2020-11-29T11:40:02.513904+00:00 app[web.1]: npm ERR! Failed at the [email protected] start script.
2020-11-29T11:40:02.514025+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-11-29T11:40:02.524049+00:00 app[web.1]: 
2020-11-29T11:40:02.524269+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-11-29T11:40:02.524394+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2020-11-29T11_40_02_514Z-debug.log
2020-11-29T11:40:02.570419+00:00 heroku[web.1]: Process exited with status 1
2020-11-29T11:40:02.617901+00:00 heroku[web.1]: State changed from starting to crashed

I've seen some similar issues on Stack Overflow but I couldn't derive a solution from any of them. Any help on this is appreciated.

Upvotes: 1

Views: 1116

Answers (1)

Kyle Lambert
Kyle Lambert

Reputation: 389

Managed to figure this one out. I think it was a problem with the Strapi version I was using and the pg dependency. I just clean installed Strapi again with the latest stable release and it fixed this issue.

Upvotes: 0

Related Questions