Issue Deploying Next.js 13 with Bun 1.0
For better or worse I've decided to follow the hype train and am trying to get Bun 1.0 working with my Next.js 13 project on railway. Prior to using Bun the project has been deploying perfectly fine. I have followed the many threads already made here about Bun and am using the special Nixpkgs archive to make sure I have bun 1.0 available.
The funky thing is the project actually appears to build fine. Meaning there are no errors during the build. An image is produced and then it's deployed. The error only occurs during actually running the app when I get the following error:
This causes the deployment to error out and consider itself "completed" not "active". I have tried building then running the package locally on my M2 macbook and it works fine.
The only final clue I can offer is that weirdly the output during the build step is missing the Next.js route type output. That part where it tells you what route will be what. SSR, Static, etc. It appears on my local computer, but not during the build on railway and it definitely used to when using pure yarn/node.
However, it again does not produce and error, there's just no output:
52 Replies
Project ID:
d56d2d18-a224-4e42-89ad-f6d1f43b6b55
d56d2d18-a224-4e42-89ad-f6d1f43b6b55
Larger snippet of the build log
Potentially related github issue on Bun: https://github.com/oven-sh/bun/issues/4795
GitHub
Bun + Nextjs + Docker: Incomplete .next build output in docker, but...
What version of Bun is running? 1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983 What platform is your computer? Linux 6.2.0-32-generic x86_64 x86_64 What steps can reproduce the bug? git clone git@g...
not much we can do for you if this is a bun issue
I'm not sure it's a bun issue persay. Again it works fine on my local machine, just on railway it seems like for whatever reason the proper Next.js files aren't built or put in the right place
railway does use docker, and if bun isn't playing nicely in a docker environment there's again not much we can do for you here
Are you aware of anyone getting Next.js and bun to work on railway because this is currently a blocker for me. That issue I pointed out might be the cause, but it was just something that seemed similar. I'm still worried I'm potentially doing something dumb.
i am not aware of anyone who got Next.js and bun to work on railway
Not sure, but maybe this can help?
https://stackoverflow.com/questions/76897466/dockerize-next-js-13-docker-compose-yml
Hmm that's interesting but to be clear I'm not directly using docker. I'm using Nixpacks. Hence why I'm asking for help here
nixpacks uses docker
I understand that, but then how would you implement this given there's no docker yml file
https://stackoverflow.com/a/76898046/6575991? Is it something in Nixpack toml?
Stack Overflow
Dockerize next.js 13 docker-compose.yml
I'm building a next.js 13 app, I want to dockerize it.
My docker file Dockerfile is working but now I want to use docker-compose.yml file to use my dockerfile.
I tried old versions new versions light
nixpacks runs
npm run build
if you have a build script in your package.jsonHmm maybe I'm not understanding you or I wasn't clear in the beginning. But basically all I have changed is switching to Bun. Before that I was using no additional config on Railway. It detected it was a Next.js project and my build command is 'bun run build' and my start command is 'bun run start' with those mapping to: 'next build' and 'next start' respectively. Everything worked fine. I'm only sticking with this because I figured some other people may come across this issue as well. I'm not even sure what the issue is, but for whatever reason when the deploy step runs my start command it fails with my above error message