R
Railway

✋|help

Cache mount ID is not prefixed with cache key when deploying test instance

Rrob93c5/6/2023
Hello all, today I tried to boot up my test instance but every attempt at doing so lead the deploys to fail immediately with the error Cache mount ID is not prefixed with cache key (no further information are present in build logs). The Dockerfile used to build the project is the following (as copied from GitHub https://github.com/Stickerifier/Stickerify/blob/migrate-to-telegram-bot-api/Dockerfile):
FROM gradle:8.0-jdk19 AS builder
WORKDIR /app
COPY settings.gradle build.gradle ./
COPY gradle/libs.versions.toml ./gradle/
RUN \
--mount=type=cache,id=cache-dependencies,target=/home/gradle/.gradle/caches \
gradle dependencies --no-daemon
COPY . .
RUN gradle shadowJar --no-daemon

FROM eclipse-temurin:19 AS bot
RUN \
--mount=type=cache,id=cache-apt,target=/var/cache/apt \
apt-get -y update && apt-get -y upgrade && \
apt-get install -y --no-install-recommends ffmpeg
ARG STICKERIFY_TOKEN
ENV STICKERIFY_TOKEN $STICKERIFY_TOKEN
WORKDIR /app
COPY --from=builder /app/build/libs .
CMD ["java", "-jar", "Stickerify-shadow.jar"]
FROM gradle:8.0-jdk19 AS builder
WORKDIR /app
COPY settings.gradle build.gradle ./
COPY gradle/libs.versions.toml ./gradle/
RUN \
--mount=type=cache,id=cache-dependencies,target=/home/gradle/.gradle/caches \
gradle dependencies --no-daemon
COPY . .
RUN gradle shadowJar --no-daemon

FROM eclipse-temurin:19 AS bot
RUN \
--mount=type=cache,id=cache-apt,target=/var/cache/apt \
apt-get -y update && apt-get -y upgrade && \
apt-get install -y --no-install-recommends ffmpeg
ARG STICKERIFY_TOKEN
ENV STICKERIFY_TOKEN $STICKERIFY_TOKEN
WORKDIR /app
COPY --from=builder /app/build/libs .
CMD ["java", "-jar", "Stickerify-shadow.jar"]
It's also worth keeping in mind I configured the shared environment variable (used both by Production and Test) RAILWAY_DOCKERFILE_PATH with value Railway.dockerfile where I'd execute the following instructions:
FROM rob93c/stickerify
ARG STICKERIFY_TOKEN
ENV STICKERIFY_TOKEN $STICKERIFY_TOKEN
FROM rob93c/stickerify
ARG STICKERIFY_TOKEN
ENV STICKERIFY_TOKEN $STICKERIFY_TOKEN
This failure seems strange to me since everything works properly in my production environment. The project ID is f6d25e17-9bb2-457f-8ce2-e55b5ce1dcd8
PPercy5/6/2023
Project ID: f6d25e17-9bb2-457f-8ce2-e55b5ce1dcd8,8c4e4e87-7cf3-4ab2-9ec2-b6cc41db7b5b
Rrob93c5/16/2023
Is there any news about this? I just tried and it's still happening in my test environment To me it's very strange since Railway on that instance should be picking Railway.dockerfile (but no logs are shown in the build view, apart from the error I reported) Also, if I don't change my Dockerfile to add ,id=cache-dependencies and ,id=cache-apt I get the error Cache mounts MUST be in the format --mount=type=cache,id=<cache-id>
BBrody5/16/2023
okay so I have asked jr myself about this, the id needs to be prefixed with your service id, anything else won't work at the moment. so when it gives you that error, this is the format it wants for the id.. id=s/<service-id>-/root/.gradle
Rrob93c5/16/2023
I must say I'm confused by that but I see it works Do you think this it a bug at some level on the tools I'm using or is it simply a wrong Dockerfile configuration on my side?
BBrody5/16/2023
its just how railway wants the cache id formatted
Jjetpackjoe7/19/2023
I hit this error too. What exactly is the format it wants? I have the following line in my Dockerfile and still got the error "Cache mount ID is not prefixed with cache key"
RUN --mount=type=cache,id=cache-pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN --mount=type=cache,id=cache-pnpm,target=/pnpm/store pnpm install --frozen-lockfile
Jjetpackjoe7/19/2023
sorry, what is <service-id> here?
BBrody7/19/2023
your railway service id
Jjetpackjoe7/19/2023
RUN --mount=type=cache,id=c23befe0-e87a-42f6-a6d5-c4a5c738679d-cache-pnpm,target=/pnpm/store pnpm install --frozen-lockfile still fails with the same error its fine, I don't need to cache there.
Jjetpackjoe7/19/2023
I don't understand what format it wants. I have it prefixed with the service id.
BBrody7/19/2023
the format is shown in that message

Looking for more? Join the community!

Want results from more Discord servers?
Add your server
Recommended Posts
Running DB migrations during CI/CD pipelineHey there 👋 I've been looking into the proper way of running DB migrations (with Prisma in my casPostgres could not resize shared memory segmentThis comes up when trying to run VACUUM on some of our tables, so far its not a big deal but could bDash is running on http://127.0.0.1:5984/ but server errorHi, it is my first time using Railway app, the build is active but server error, and it says: Looks mongodb collection missingihave a few collection in my database that i am not seeing but i can query in script, is there a bugGetting error: net::ERR_ABORTED 426, with Shopify appI have a shopify app hosted on railway, and when calling any of my fetch requests through a proxy, RollupError: Could not resolve "./Components/Header/Navbar" from "src/App.jsx"I am having an issue where railway Rollup connot find my Navbar component But it the import is corrSupport Update 003This series is for keeping everyone in the loop about what’s happening in support land. This way youdjango keeps failing it say> [stage-0 8/10] RUN chmod u+x release.sh && ./release.sh: #12 1.649 ModuleNotFoundError: No modulhow to backup mongodb?project: 448a8382-6e3f-42d6-a3cd-a9a8c5493c1d is there a way to simply backup a mongodb to a zip orPostgres could not resize shared memory segmentThis comes up when trying to run VACUUM on some of our tables, so far its not a big deal but could bService config path setting missingHi there, I have a mono repo setup with turborepo and I am looking to create a separate railway.jsoHow to interconnect services ?Hi, So I am having this issue. I have a node express server and a node telegram server. The telegramContainer failed to start - activity StartToClose timeoutEverything was working fine before, but when I pushed a few more files (about 1gb) in my latest commCannot deploy templateYesterday this would show me the form for the template, now I get this. 🤔Railway build errorI'm having a problem deploying an API. It's indicating that one of my migrations is causing this errDjango app failing all of a suddenI recently pushed a minor template update to my Django app and noticed the build failed. The logs shWhy are failed deployments not removed automatically?And is there a configuration option to enable this?Issue with Postgres on deployment. ECONNREFUSEDHello, I have an issue that the railway service seems to not connect to the Postgre database even tIssue with Postgres on deploymentHello, My node.js backend for a python-based bot is crashing on deployment because of an error conNixpacks build with no dockerHello, is it possible to use nixpacks, just to generate the dockerfile, and don't run the build comm