_typedev
_typedev
RRailway
Created by _typedev on 11/3/2023 in #✋|help
Next 14 with bun 1.0.7
First of all thanks @Brody ! For anyone currently working with Bun/Next.js/Railway this might be helpful: For me , builds with next.js kept failing, and I’ve tried everything a lot of different methods, and configurations What worked was Brody’s solution to separate the nixplan from the railway.config into a nixpack.config "nixpacksConfigPath": "apps/next/nixpacks.toml"
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"watchPatterns": ["apps/next/**"],
"nixpacksConfigPath": "apps/next/nixpacks.toml"
},
"deploy": {
"numReplicas": 1,
"sleepApplication": false,
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"watchPatterns": ["apps/next/**"],
"nixpacksConfigPath": "apps/next/nixpacks.toml"
},
"deploy": {
"numReplicas": 1,
"sleepApplication": false,
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}
buildImage = 'ghcr.io/railwayapp/nixpacks:ubuntu-1697500996'

[variables]
CI = 'true'
NODE_ENV = 'production'
NIXPACKS_METADATA = 'node'
NIXPACKS_NO_CACHE = '1'
NPM_CONFIG_PRODUCTION = 'false'

[phases.setup]
nixPkgs = ['nodejs_20', 'bun']
nixOverlays = ['https://github.com/railwayapp/nix-npm-overlay/archive/main.tar.gz']
nixpkgsArchive = 'a3d8834fae7c986033e72db669239cd9c1cedc96'

[phases.install]
cmds = ['bun i']
paths = ['/app/node_modules/.bin']
dependsOn = ['setup']
cacheDirectories = ['/root/.bun']

[phases.build]
cmds = ['bun run --cwd "apps/next" build']
dependsOn = ['install']
cacheDirectories = ['apps/next/.next/cache', 'node_modules/.cache']

[start]
cmd = 'bun run --cwd "apps/next" start'
buildImage = 'ghcr.io/railwayapp/nixpacks:ubuntu-1697500996'

[variables]
CI = 'true'
NODE_ENV = 'production'
NIXPACKS_METADATA = 'node'
NIXPACKS_NO_CACHE = '1'
NPM_CONFIG_PRODUCTION = 'false'

[phases.setup]
nixPkgs = ['nodejs_20', 'bun']
nixOverlays = ['https://github.com/railwayapp/nix-npm-overlay/archive/main.tar.gz']
nixpkgsArchive = 'a3d8834fae7c986033e72db669239cd9c1cedc96'

[phases.install]
cmds = ['bun i']
paths = ['/app/node_modules/.bin']
dependsOn = ['setup']
cacheDirectories = ['/root/.bun']

[phases.build]
cmds = ['bun run --cwd "apps/next" build']
dependsOn = ['install']
cacheDirectories = ['apps/next/.next/cache', 'node_modules/.cache']

[start]
cmd = 'bun run --cwd "apps/next" start'
Notes: passing in :nodejs_20 so builds work with next.js 14.0 Using the cmd bun run --cwd "apps/next" build to path to the directory and then build from there. This will correctly link packages workspace:* If builds are failing you might want to clean your bun.lockb from the root of your project rm -f bun.lockb then bun i Successfully deploys 14 with bun 1.0.7
17 replies
RRailway
Created by _typedev on 11/3/2023 in #✋|help
Next 14 with bun 1.0.7
Amazing! Doing a write up right now
17 replies
RRailway
Created by _typedev on 11/3/2023 in #✋|help
Next 14 with bun 1.0.7
Let me give that a shot too
17 replies
RRailway
Created by _typedev on 11/3/2023 in #✋|help
Next 14 with bun 1.0.7
No description
17 replies
RRailway
Created by _typedev on 11/3/2023 in #✋|help
Next 14 with bun 1.0.7
Going to give it a show, I appreciate the follow-up I saw that you mentioned NIXPACKS_NO_CACHE=1 for skipping caching when using railway.toml Would this be the case for the railway.json?
"variables":{
"NIXPACKS_NO_CACHE": "1",
}
"variables":{
"NIXPACKS_NO_CACHE": "1",
}
17 replies
RRailway
Created by _typedev on 11/3/2023 in #✋|help
Next 14 with bun 1.0.7
No description
17 replies
RRailway
Created by _typedev on 11/3/2023 in #✋|help
Next 14 with bun 1.0.7
1835b3bd-c387-4d79-ace9-a0e10cb05feb
17 replies