Cant deploy my gatsby site because of env variables

I have had a similar issue using a Firebase private key as an env variable.

If it is a similar issue, you could try processing the GATSBY_PRIVATE_KEY with JSON.parse()

credentials: {
  client_email: GATSBY_CLIENT_EMAIL,
  private_key: GATSBY_PRIVATE_KEY[0] === '-' ? GATSBY_PRIVATE_KEY : JSON.parse(GATSBY_PRIVATE_KEY)
}

See previous post: