Error below is from the @sentry/cli/sentry-cli tool run via yarn build:
SSL peer certificate or SSH remote key was not OK (SSL certificate problem: unable to get local issuer certificate)
First check the certificate of sentry host the sentry-cli is trying to connect to. This is a website hosting sentry secured with https like https://sentry.mydomain.com/. Maybe the certificate here is expired.
If that's not the problem try other solutions like installing the ca-certificates if the build is done via Docker e.g.
... FROM node:17.5.0-alpine AS deps RUN apk add --no-cache libc6-compat ca-certificates curl ...
Check references for github issue.