Hey,
I’m not able anymore to mount a secret and make it work through the command:
fly deploy --build-secret SENTRY_AUTH_TOKEN=token
In my dockerfile I did:
RUN --mount=type=secret,id=SENTRY_AUTH_TOKEN \
SENTRY_AUTH_TOKEN="$(cat /run/secrets/SENTRY_AUTH_TOKEN)"
It worked before, but now it just don’t seems.
error: Auth token is required for this request. Please run
sentry-cli login and try again!
Using
fly v0.2.72 darwin/amd64 Commit: df7529f6da985a662853ffc7003f57ee3c9d8e42 BuildDate: 2024-06-18T23:04:13Z
Thanks
rubys
June 25, 2024, 4:05pm
2
Can you show a bit more of your dockerfile… I was expecting something like:
RUN --mount=type=secret,id=SENTRY_AUTH_TOKEN \
SENTRY_AUTH_TOKEN="$(cat /run/secrets/SENTRY_AUTH_TOKEN)" && \
cmd_to_be_run_with_sentry_auth_token
Key here is that the secret will be available for the duration of the single RUN
statement containing the mount.
I’m running just after :
RUN npm run build-ts
Which fail.
That do
"cross-env NODE_ENV=production tsc && npm run sentry:sourcemaps",
sentry:sourcemaps do this
sentry-cli sourcemaps inject --org orgName --project projectName ./dist && sentry-cli sourcemaps upload --org orgName --project projectName ./dist
Also weird behaviour, it build twice.
Thanks
rubys
June 25, 2024, 4:23pm
4
If you Dockerfile looks like this:
RUN --mount=type=secret,id=SENTRY_AUTH_TOKEN \
SENTRY_AUTH_TOKEN="$(cat /run/secrets/SENTRY_AUTH_TOKEN)"
RUN npm run build-ts
… then you are setting the secret, completing the step, and then running a completely separate RUN statement without access to the secret. What you want instead is:
RUN --mount=type=secret,id=SENTRY_AUTH_TOKEN \
SENTRY_AUTH_TOKEN="$(cat /run/secrets/SENTRY_AUTH_TOKEN)" && \
npm run build-ts
Unfortunately, it did not work, here’s the command I am using :
fly deploy --build-secret SENTRY_AUTH_TOKEN="myToken"
It worked before for months, so that’s why it’s confusing.