turbo icon indicating copy to clipboard operation
turbo copied to clipboard

Turborepo with custom server in Typescript fails during Heroku start after build, couldn't load next.config.js file

Open clumsier opened this issue 3 years ago • 0 comments

What version of Turborepo are you using?

latest

What package manager are you using / does the bug impact?

Yarn v1

What operating system are you using?

Linux

Describe the Bug

I'm currently trying to deploy starter with mocked api path and custom server in Typescript on Heroku. Build + Start scripts are working locally atm.

I've followed up a sample repo which I found on Discord - https://github.com/cedric25/try-turborepo . Author of that repo is not using Next.js for server but other stuff and I've tried to recreate that repo but with Next.js server. Everything seems to be configured in a similar fashion, however when running start script on server I get such error:

2022-09-01T12:15:46.937949+00:00 heroku[web.1]: State changed from crashed to starting
2022-09-01T12:15:51.638783+00:00 heroku[web.1]: Starting process with command `npx turbo run start --filter=web`
2022-09-01T12:15:54.134361+00:00 app[web.1]: npm WARN exec The following package was not found and will be installed: [email protected]
2022-09-01T12:15:55.335677+00:00 app[web.1]:  WARNING  cannot find a .git folder. Falling back to manual file hashing (which may be slower). If you are running this build in a pruned directory, you can ignore this message. Otherwise, please initialize a git repository in the root of your monorepo
2022-09-01T12:15:55.343661+00:00 app[web.1]: • Packages in scope: web
2022-09-01T12:15:55.343667+00:00 app[web.1]: • Running start in 1 packages
2022-09-01T12:15:55.343872+00:00 app[web.1]: web:start: cache miss, executing ac805fbcaf77fe1d
2022-09-01T12:15:55.779425+00:00 app[web.1]: web:start: yarn run v1.22.19
2022-09-01T12:15:55.813586+00:00 app[web.1]: web:start: $ NODE_ENV=production node ./dist/index.js
2022-09-01T12:15:56.376153+00:00 app[web.1]: web:start: error - Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error
2022-09-01T12:15:56.389930+00:00 app[web.1]: web:start: Done in 0.61s.
2022-09-01T12:15:56.402058+00:00 app[web.1]: 
2022-09-01T12:15:56.402102+00:00 app[web.1]:  Tasks:    1 successful, 1 total
2022-09-01T12:15:56.402115+00:00 app[web.1]: Cached:    0 cached, 1 total
2022-09-01T12:15:56.402137+00:00 app[web.1]:   Time:    1.102s 
2022-09-01T12:15:56.402140+00:00 app[web.1]: 
2022-09-01T12:15:56.631701+00:00 heroku[web.1]: State changed from starting to crashed

I've already tried with different Node versions, 18~ and 16~ but result seems to be the same.

Expected Behavior

Server should start on heroku.

To Reproduce

Clone my public repo https://github.com/clumsier/turborepo-test

Try to deploy on Heroku.

EDIT:

  • seems like it is something with next-transpile-modules, as when I've removed that on branch playground deployment is proceeding

clumsier avatar Sep 01 '22 12:09 clumsier