#Disable Cache for build step on Railway
5 messages · Page 1 of 1 (latest)
docker layers will always be cached, this isn't something that can be turned off, but your problem is likely elsewhere.
so what is the specific issue you are trying to debug?
Hi @agile wyvern ... I'm really pulling my hair out on this one!
I'm deploying a Medusa backend and have extended the product service. Everything works on my local machine, however I get the following error on my production instance on Railway...
165.165.142.241 - - [09/Jan/2024:10:15:05 +0000] "GET /store/products HTTP/1.1" 500 86 "-" "PostmanRuntime/7.36.0"
running custom product listAndCount
error: productRepo.findWithRelationsAndCount is not a function
TypeError: productRepo.findWithRelationsAndCount is not a function
at ProductService.<anonymous> (/app/node_modules/@medusajs/medusa/dist/services/product.js:197:62)
at step (/app/node_modules/@medusajs/medusa/dist/services/product.js:59:23)
at Object.next (/app/node_modules/@medusajs/medusa/dist/services/product.js:40:53)
at /app/node_modules/@medusajs/medusa/dist/services/product.js:34:71
at new Promise (<anonymous>)
at __awaiter (/app/node_modules/@medusajs/medusa/dist/services/product.js:30:12)
at ProductService.listAndCount (/app/node_modules/@medusajs/medusa/dist/services/product.js:186:16)
at ProductService.listAndCount (/app/dist/services/product.js:38:28)
at /app/node_modules/@medusajs/medusa/dist/api/routes/store/products/list-products.js:335:50
at step (/app/node_modules/@medusajs/medusa/dist/api/routes/store/products/list-products.js:68:23)
in trying to debug this issue, I have tried my best to reproduce the Railway deploy environment on my local machine:
- Build with Nixpacks locally and run with Docker (works as expected locally)
- Build with Docker using Dockerfile (modified Nixpacks output).... and build on Railway with same Dockerfile
- still works as expected locally but throws above error on Railway
I'm running out of ideas why this is happening. Dockerfile below for interest...
'''
FROM ghcr.io/railwayapp/nixpacks:ubuntu-1702339400
ENTRYPOINT ["/bin/bash", "-l", "-c"]
WORKDIR /app/
COPY nixpkgs-bf744fe90419885eefced41b3e5ae442d732712d.nix nixpkgs-bf744fe90419885eefced41b3e5ae442d732712d.nix
RUN nix-env -if nixpkgs-bf744fe90419885eefced41b3e5ae442d732712d.nix && nix-collect-garbage -d
ARG CI NIXPACKS_METADATA NODE_ENV NPM_CONFIG_PRODUCTION SERVER_ONLY
ENV CI=$CI NIXPACKS_METADATA=$NIXPACKS_METADATA NODE_ENV=$NODE_ENV NPM_CONFIG_PRODUCTION=$NPM_CONFIG_PRODUCTION SERVER_ONLY=$SERVER_ONLY
# setup phase
# noop
# install phase
ENV NIXPACKS_PATH /app/node_modules/.bin:$NIXPACKS_PATH
COPY . /app/.
RUN npm i
# build phase
COPY . /app/.
RUN npm run build
RUN printf '\nPATH=/app/node_modules/.bin:$PATH' >> /root/.profile
# start
COPY . /app
CMD ["medusa migrations run && medusa start"]