R
Railway2y ago
Gaden

Monorepo sub directory deployment failing

Hello. I wish to deploy a sub directory of my mono repo. The sub dir that i wish to deploy is /apps/points-server This is how my variables are set Root Directory /apps/points-server Build Command Build Command Watch Paths /apps/points-server Start command pnpm run start This is the logs i get after trying to deploy:
#1 [internal] load build definition from Dockerfile

#1 transferring dockerfile: 2.19kB done

#1 DONE 0.3s


#2 [internal] load .dockerignore

#2 transferring context: 2B done
#2 DONE 0.4s

#3 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1678752204

#3 DONE 0.1s


#4 [stage-0 1/8] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1678752204@sha256:fba77818e57bebd4e7a02f60d45554354d6ec5a3f7d98b4ee4f6b2a6e720191e
#4 DONE 0.0s


#5 [internal] load build context

#5 transferring context: 18.64kB done

#5 DONE 0.3s

#6 [stage-0 4/10] RUN nix-env -if .nixpacks/nixpkgs-293a28df6d7ff3dec1e61e37cc4ee6e6c0fb0847.nix && nix-collect-garbage -d
#6 CACHED

#7 [stage-0 2/8] WORKDIR /app/
#7 CACHED

#8 [stage-0 3/10] COPY .nixpacks/nixpkgs-293a28df6d7ff3dec1e61e37cc4ee6e6c0fb0847.nix .nixpacks/nixpkgs-293a28df6d7ff3dec1e61e37cc4ee6e6c0fb0847.nix
#8 CACHED


#9 [stage-0 5/10] RUN printf '\nPATH=/app/node_modules/.bin:$PATH' >> /root/.profile

#9 DONE 0.8s

#10 [stage-0 6/10] COPY . /app/.

#10 DONE 0.3s

#11 [stage-0 7/10] RUN --mount=type=cache,id=s/dda6e822-b6a7-446d-9689-244823126a93-/root/npm,target=/root/.npm npm i

#11 0.973 npm
WARN config production Use `--omit=dev` instead.

#11 1.631 npm ERR! code EUNSUPPORTEDPROTOCOL
#11 1.633 npm ERR! Unsupported URL Type "workspace:": workspace:0.0.0
#11 1.635
#11 1.635 npm ERR! A complete log of this run can be found in:
#11 1.635 npm ERR! /root/.npm/_logs/2023-05-10T19_26_02_588Z-debug-0.log

#11 ERROR: process "/bin/bash -ol pipefail -c npm i" did not complete successfully: exit code: 1
-----
> [stage-0 7/10] RUN --mount=type=cache,id=s/dda6e822-b6a7-446d-9689-244823126a93-/root/npm,target=/root/.npm npm i:
WARN config production Use `--omit=dev` instead.
#11 1.631 npm ERR! code EUNSUPPORTEDPROTOCOL
#11 1.633 npm ERR! Unsupported URL Type "workspace:": workspace:0.0.0
#11 1.635
#11 1.635 npm ERR! A complete log of this run can be found in:
#11 1.635 npm ERR! /root/.npm/_logs/2023-05-10T19_26_02_588Z-debug-0.log
-----

Dockerfile:21
-------------------
19 | RUN printf '\nPATH=/app/node_modules/.bin:$PATH' >> /root/.profile
20 | COPY . /app/.
21 | >>> RUN --mount=type=cache,id=s/dda6e822-b6a7-446d-9689-244823126a93-/root/npm,target=/root/.npm npm i
22 |
23 | # build phase
-------------------
ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm i" did not complete successfully: exit code: 1

Error: Docker build failed
#1 [internal] load build definition from Dockerfile

#1 transferring dockerfile: 2.19kB done

#1 DONE 0.3s


#2 [internal] load .dockerignore

#2 transferring context: 2B done
#2 DONE 0.4s

#3 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1678752204

#3 DONE 0.1s


#4 [stage-0 1/8] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1678752204@sha256:fba77818e57bebd4e7a02f60d45554354d6ec5a3f7d98b4ee4f6b2a6e720191e
#4 DONE 0.0s


#5 [internal] load build context

#5 transferring context: 18.64kB done

#5 DONE 0.3s

#6 [stage-0 4/10] RUN nix-env -if .nixpacks/nixpkgs-293a28df6d7ff3dec1e61e37cc4ee6e6c0fb0847.nix && nix-collect-garbage -d
#6 CACHED

#7 [stage-0 2/8] WORKDIR /app/
#7 CACHED

#8 [stage-0 3/10] COPY .nixpacks/nixpkgs-293a28df6d7ff3dec1e61e37cc4ee6e6c0fb0847.nix .nixpacks/nixpkgs-293a28df6d7ff3dec1e61e37cc4ee6e6c0fb0847.nix
#8 CACHED


#9 [stage-0 5/10] RUN printf '\nPATH=/app/node_modules/.bin:$PATH' >> /root/.profile

#9 DONE 0.8s

#10 [stage-0 6/10] COPY . /app/.

#10 DONE 0.3s

#11 [stage-0 7/10] RUN --mount=type=cache,id=s/dda6e822-b6a7-446d-9689-244823126a93-/root/npm,target=/root/.npm npm i

#11 0.973 npm
WARN config production Use `--omit=dev` instead.

#11 1.631 npm ERR! code EUNSUPPORTEDPROTOCOL
#11 1.633 npm ERR! Unsupported URL Type "workspace:": workspace:0.0.0
#11 1.635
#11 1.635 npm ERR! A complete log of this run can be found in:
#11 1.635 npm ERR! /root/.npm/_logs/2023-05-10T19_26_02_588Z-debug-0.log

#11 ERROR: process "/bin/bash -ol pipefail -c npm i" did not complete successfully: exit code: 1
-----
> [stage-0 7/10] RUN --mount=type=cache,id=s/dda6e822-b6a7-446d-9689-244823126a93-/root/npm,target=/root/.npm npm i:
WARN config production Use `--omit=dev` instead.
#11 1.631 npm ERR! code EUNSUPPORTEDPROTOCOL
#11 1.633 npm ERR! Unsupported URL Type "workspace:": workspace:0.0.0
#11 1.635
#11 1.635 npm ERR! A complete log of this run can be found in:
#11 1.635 npm ERR! /root/.npm/_logs/2023-05-10T19_26_02_588Z-debug-0.log
-----

Dockerfile:21
-------------------
19 | RUN printf '\nPATH=/app/node_modules/.bin:$PATH' >> /root/.profile
20 | COPY . /app/.
21 | >>> RUN --mount=type=cache,id=s/dda6e822-b6a7-446d-9689-244823126a93-/root/npm,target=/root/.npm npm i
22 |
23 | # build phase
-------------------
ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm i" did not complete successfully: exit code: 1

Error: Docker build failed
This is the package.json of the sub dir
{
"name": "points-server",
"displayName": "Points Server",
"version": "0.0.7",
"author": "Sidekick Wallet, Inc",
"scripts": {
"start": "ts-node index.ts"
},
"dependencies": {
"@acme/db": "*",
"discord.js": "^14.10.2",
"dotenv": "^16.0.3",
"eslint": "^8.34.0",
"eslint-config-acme": "workspace:0.0.0",
"ethers": "^5.7.2",
"fastify": "^4.17.0",
"zod": "^3.21.4"
},
"devDependencies": {
"prettier": "2.8.4",
"ts-node": "^10.9.1",
"typescript": "4.9.5"
}
}
{
"name": "points-server",
"displayName": "Points Server",
"version": "0.0.7",
"author": "Sidekick Wallet, Inc",
"scripts": {
"start": "ts-node index.ts"
},
"dependencies": {
"@acme/db": "*",
"discord.js": "^14.10.2",
"dotenv": "^16.0.3",
"eslint": "^8.34.0",
"eslint-config-acme": "workspace:0.0.0",
"ethers": "^5.7.2",
"fastify": "^4.17.0",
"zod": "^3.21.4"
},
"devDependencies": {
"prettier": "2.8.4",
"ts-node": "^10.9.1",
"typescript": "4.9.5"
}
}
19 Replies
Percy
Percy2y ago
Project ID: dda6e822-b6a7-446d-9689-244823126a93,dda6e822-b6a7-446d-9689-244823126a93,dda6e822-b6a7-446d-9689-244823126a93
Brody
Brody2y ago
Unsupported URL Type "workspace:": workspace:0.0.0
is workspace:0.0.0 supposed to be a supported URL type?
Gaden
GadenOP2y ago
I have no clue. It works just fine in development environment I think it might be using npm for the npm install command Can i force it to use pnpm?
Brody
Brody2y ago
pnpm is used if a pnpm-lock.yaml file is detected can you show me the table at the top of the build logs?
Gaden
GadenOP2y ago

==============
Using Nixpacks
==============
context: 0131630cea8b938be2599093f241e9a9

╔═════════ Nixpacks v1.5.1 ═════════╗
║ setup │ nodejs-16_x, npm-8_x ║
║───────────────────────────────────║
║ install │ npm i ║
║───────────────────────────────────║
║ build │ pnpm i ║
║───────────────────────────────────║
║ start │ pnpm run start ║
╚═══════════════════════════════════╝

==============
Using Nixpacks
==============
context: 0131630cea8b938be2599093f241e9a9

╔═════════ Nixpacks v1.5.1 ═════════╗
║ setup │ nodejs-16_x, npm-8_x ║
║───────────────────────────────────║
║ install │ npm i ║
║───────────────────────────────────║
║ build │ pnpm i ║
║───────────────────────────────────║
║ start │ pnpm run start ║
╚═══════════════════════════════════╝
Brody
Brody2y ago
can you share a link to your repo?
Gaden
GadenOP2y ago
Unfortunately i cannot 😦 Im employed for the project, and it is not opensource atm
Brody
Brody2y ago
do you have a pnpm-lock.yaml file in that sub directory?
Gaden
GadenOP2y ago
the pnpm-lock.yaml is located in the directory above the sub directory maybe that is whats causing it
Brody
Brody2y ago
it is
Gaden
GadenOP2y ago
then instead of defining the root dir, i should maybe change the "start" command to cd into the sub dir, and then run it
Brody
Brody2y ago
you have also mistakenly tried to overwrite the build and start commands in the service settings no this would be a hack, place the lock file into the correct directory
Gaden
GadenOP2y ago
hmmmm. is it bad practice to share lock file across all sub directories in a mono repo?
Brody
Brody2y ago
in my experience the difference services inside a mono repo (where both are node apps) would have their own package and package lock files
Gaden
GadenOP2y ago
okayi
Gaden
GadenOP2y ago
GitHub
GitHub - t3-oss/create-t3-turbo: Clean and simple starter repo usin...
Clean and simple starter repo using the T3 Stack along with Expo React Native - GitHub - t3-oss/create-t3-turbo: Clean and simple starter repo using the T3 Stack along with Expo React Native
Gaden
GadenOP2y ago
i used this as the template for the repo and they just use one main lock file i guess i gotta figure out how to change it so there is only one then mono repos are hard 😛
Brody
Brody2y ago
yes but railway relies on the presence of a pnpm lock file to know the app uses pnpm
Gaden
GadenOP2y ago
I think it would make more sense for railway to add the option to specify your own install command Having multiple lock files eliminates some of the benefits from having mono repo Install command just need to cd into the correct dir, and it will work
Want results from more Discord servers?
Add your server