I'm having a problem with deploying typeorm app on heroku. Here's the completely minimalistic version of this app: https://github.com/wiktorkujawa/typeorm-heroku
So what I've done:
Installed dependencies for server.
Created react project and install dependencies for them: npx create-react-app web --typescript yarn add ... 2.Create graphql folder inside src folder and initialize graphql code generator npx graphql-codegen init
Where is your schema?: http://localhost:4000/graphql Where are your operations and fragments?: src/graphql/*.graphql Where to write output: (let it be default) ...(default) What script in package.json should run the codegen? gen
In codegen.yml added:
config:
hooksImportFrom: '@apollo/react-hooks'
withHooks: true
withHOC: false
withComponent: false
and installed dependencies of codegen with: yarn 3. generate schemas: yarn gen 4. In index.tsx copied code from https://www.apollographql.com/docs/react/migrating/boost-migration/#advanced-migration
Application error An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command heroku logs --tail
Here's the error after typing heroku logs --tail in terminal:
2020-06-28T18:40:57.079023+00:00 app[web.1]: > [email protected] start /app
2020-06-28T18:40:57.079024+00:00 app[web.1]: > ts-node src/index.ts
2020-06-28T18:40:57.079024+00:00 app[web.1]:
2020-06-28T18:40:57.085699+00:00 app[web.1]: sh: 1: ts-node: not found
2020-06-28T18:40:57.095880+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-06-28T18:40:57.096505+00:00 app[web.1]: npm ERR! syscall spawn
2020-06-28T18:40:57.097800+00:00 app[web.1]: npm ERR! file sh
2020-06-28T18:40:57.098220+00:00 app[web.1]: npm ERR! errno ENOENT
2020-06-28T18:40:57.099843+00:00 app[web.1]: npm ERR! [email protected] start: `ts-node src/index.ts`
2020-06-28T18:40:57.100130+00:00 app[web.1]: npm ERR! spawn ENOENT
2020-06-28T18:40:57.100384+00:00 app[web.1]: npm ERR!
2020-06-28T18:40:57.100546+00:00 app[web.1]: npm ERR! Failed at the [email protected] start script.
2020-06-28T18:40:57.100713+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-06-28T18:40:57.119552+00:00 app[web.1]:
2020-06-28T18:40:57.120040+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-06-28T18:40:57.120170+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-06-28T18_40_57_105Z-debug.log
2020-06-28T18:40:57.195532+00:00 heroku[web.1]: Process exited with status 1
2020-06-28T18:40:57.257902+00:00 heroku[web.1]: State changed from starting to crashed
2020-06-28T18:41:03.656226+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=typeorm-heroku.herokuapp.com request_id=4e810375-5365-47c5-bccd-a6b28a893359 fwd="178.235.225.93" dyno= connect= service= status=503 bytes= protocol=https
2020-06-28T18:41:04.010781+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=typeorm-heroku.herokuapp.com request_id=1a30a549-55a7-49af-a6b5-f199ee78fda0 fwd="178.235.225.93" dyno= connect= service= status=503 bytes= protocol=https
Well, I think that the problem is in package.json, but I don't know how to fix it.
The solution was to install ts-node in dependencies( not devDependencies).