After Heroku restart: pnpm: Error: Cannot find matching keyid
Full error message
My Heroku-hosted node app stopped working this morning at 6am.
In the Heroku console I found a message "Dyno restart" at that time. At the same time, memory usage dropped to 0. Apparently the app did not recover after the restart.
I attempted to just re-run my Github Action deploy workflow to redeploy the app and trigger a restart.
I get the following error:
#11 [prod-deps 1/1] RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
#11 0.558 /usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:21535
#11 0.558 if (key == null || signature == null) throw new Error(`Cannot find matching keyid: ${JSON.stringify({ signatures, keys })}`);
#11 0.558 ^
#11 0.558
#11 0.558 Error: Cannot find matching keyid: {"signatures":[{"sig":"MEQCI...
Apparently something related to pnpm and corepack.
I found a quick fix by changing my Dockerfile:
FROM node:20-alpine AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
# RUN corepack enable # <= removed this
RUN corepack disable && npm install -g pnpm@latest # <= added this
COPY . /app
WORKDIR /app
# ...
The deployment now works again, the app is back up.
However I don't understand the underlying problem:
how could this suddenly happen?
is this a legitimate fix?Solutionsource: stackoverflow \u2197
This answer from Vercel's post worked for me. If you're on Node 18+, you can just install the latest version of corepack before enabling it. steps: - name: Use Latest Corepack run: | echo "Before: corepack version => $(corepack --version || echo 'not installed')" npm install -g corepack@latest echo "After : corepack version => $(corepack --version)" corepack enable pnpm --version Also, if you're on Node 16, they say corepack v20 still supports it.
API access
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/733502f3fa89c1f142549468b17f88c6d4698cd12a1fcf30f9c30d0af244d463hash \u00b7 733502f3fa89c1f142549468b17f88c6d4698cd12a1fcf30f9c30d0af244d463