Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy app to Heroku #520

Closed
reingoldkz opened this issue May 2, 2023 · 12 comments
Closed

Deploy app to Heroku #520

reingoldkz opened this issue May 2, 2023 · 12 comments
Assignees

Comments

@reingoldkz
Copy link

Hi async-labs team.

I am having error when deploying my app to Heroku cloud.

error:
error - Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error
2023-05-02T04:49:47.866022+00:00 app[web.1]: node:internal/modules/cjs/loader:933
2023-05-02T04:49:47.866022+00:00 app[web.1]: const err = new Error(message);
2023-05-02T04:49:47.866024+00:00 app[web.1]: ^
2023-05-02T04:49:47.866024+00:00 app[web.1]:
2023-05-02T04:49:47.866025+00:00 app[web.1]: Error: Cannot find module 'next-transpile-modules'
2023-05-02T04:49:47.866026+00:00 app[web.1]: Require stack:
2023-05-02T04:49:47.866029+00:00 app[web.1]: - /app/next.config.js
2023-05-02T04:49:47.866033+00:00 app[web.1]: at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
2023-05-02T04:49:47.866033+00:00 app[web.1]: at Function.mod._resolveFilename (/app/node_modules/next/dist/build/webpack/require-hook.js:23:32)
2023-05-02T04:49:47.866035+00:00 app[web.1]: at Function.Module._load (node:internal/modules/cjs/loader:778:27)
2023-05-02T04:49:47.866036+00:00 app[web.1]: at Module.require (node:internal/modules/cjs/loader:1005:19)
2023-05-02T04:49:47.866036+00:00 app[web.1]: at require (node:internal/modules/cjs/helpers:102:18)
2023-05-02T04:49:47.866036+00:00 app[web.1]: at Object. (/app/next.config.js:1:16)
2023-05-02T04:49:47.866037+00:00 app[web.1]: at Module._compile (node:internal/modules/cjs/loader:1105:14)
2023-05-02T04:49:47.866037+00:00 app[web.1]: at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
2023-05-02T04:49:47.866037+00:00 app[web.1]: at Module.load (node:internal/modules/cjs/loader:981:32)
2023-05-02T04:49:47.866037+00:00 app[web.1]: at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
2023-05-02T04:49:47.866039+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2023-05-02T04:49:47.866039+00:00 app[web.1]: requireStack: [ '/app/next.config.js' ]
2023-05-02T04:49:47.866039+00:00 app[web.1]: }
2023-05-02T04:49:48.082546+00:00 heroku[web.1]: Process exited with status 1
2023-05-02T04:49:48.139934+00:00 heroku[web.1]: State changed from starting to crashed


builderbook 9-end project running fine on localhost
Also, there is not problem running project on Heroku could when it is 8-end code.

The problem arises after changes on 9th chapter.

Is it because of next.js update, or something else, I can't figure it out.

Could you please take a look at error code and give me some advice.

Thanks

@reingoldkz
Copy link
Author

Hi.

I did this project in the past. And also I'm not so good at programming at the moment.

There is some breaking changes in chapter 9.

in my project 9-begin everything is kinda fine, but 9-end, I'm having issue with book chapters. Chapters are not showing when I click to book.

@klyburke
Copy link
Member

klyburke commented May 4, 2023

Hi @reingoldkz Thanks for reporting. We will look into the potential Heroku issue.

Regarding 9-end, are you running our exact code from the repo? I just ran 9-end on my machine and didn't see any issues. I am able to open my sample book and see the chapters.

Try running 9-end directly from our repo with your environmental variables.

Please also share any screenshots or error messages you see regarding "chapters are not showing".

@reingoldkz
Copy link
Author

Hi, @klyburke

If you run code locally it works fine.

But when we deploy the code to Heroku, it is giving error: Cannot find module 'next-transpile-modules'

https://nextjs.org/docs/pages/api-reference/next-config-js/transpilePackages

Next.js 13 can automatically transpile and bundle dependencies from local packages (like monorepos) or from external dependencies (node_modules). This replaces the next-transpile-modules package.

Therefor, I think we need to change next.config.js file.
But I am beginner, and can't understand, how do it correctly.

My projects running OK on Herorku, but there is the problem with showing chapters of book.

Thanks for your help.

@tima101
Copy link
Member

tima101 commented May 15, 2023

@reingoldkz Not sure about Heroku deployment. What happens when you have "next-transpile-modules" inside package.json: https://github.com/async-labs/builderbook/blob/master/builderbook/package.json

Please make sure that you run "yarn install" after adding package manually to package.json file.


If problem persists I can try deploying your project to our Heroku account. For that to happen, you can add me to your private repo and provide all necessary instructions inside repo's README.md file.

@reingoldkz
Copy link
Author

reingoldkz commented May 15, 2023

My problem: Book chapters are not showing up.

And the problem occurs right after this part of the book till the end.

https://builderbook.org/books/builder-book/prepare-project-for-deployment-environmental-variables-production-development-logger-seo-robots-txt-sitemap-xml-compression-and-security-deploy-project-heroku-testing-deployed-project-aws-elastic-beanstalk#next-js-v13-other-package-upgrades

I couldn't figure it out what is the couse.

Maybe I think it is linked to next.config.js file update and code there.

@reingoldkz
Copy link
Author

the project running OK on Heroku and loclhost:8000,

but there is a problem with showing book Chapters.

book chapters not showing up on local dev and on Heroku app.

I can't figure it out why.

@reingoldkz
Copy link
Author

error: Content sync has error {"error":{},"path":"chapter-1.md"}

@reingoldkz
Copy link
Author

Hi async-labs,

My problem is written in above messages,

I want just to give more information.

So, at the 9-begin my code and localhost dev environment runs OK.
Everything is fine.

I can add books and chapters show up. Everything is fine.

I continue to make changes on 9-th chapter, till the Next.js v13 and other packages upgrade, and I get error:
chapter is not showing up

error: Content sync has error {"error":{},"path":"chapter-1.md"}

@reingoldkz
Copy link
Author

my code is from builderbook\9-begin, I have needed env variables,

and then I switch to 9-end code, to check. but problem remains.

I can't sync Chapters.
error: Content sync has error {"error":{},"path":"chapter-1.md"}

I looked very closely and invested a lot of time, but can't figure it out.
I'm beginner, and should admit that I can't understand all the code, but I am so close to make this project to work

This problem is I can't solve at the moment.

Any assist from your side will be helpful.

Thanks

@reingoldkz
Copy link
Author

Breaking change from 9-begin to 9-end in my case was
to downgrade marked package version.
from
"marked": "^4.2.5",

to
"marked": "^1.2.7",

@tima101
Copy link
Member

tima101 commented May 17, 2023

marked should be 1.2.7 inside 9-end project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants