I found the cause after working through warnings earlier in the build.
I found this:
ERR_PNPM_OUTDATED_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with package.json
The solution was to run pnpm install
locally, and then push the updated pnpm-lock.yaml