Can't access secret in GCP Secret Manager

When you access a secret, you need to specify the project:

await secretClient.accessSecretVersion({ name: "TELEGRAM_TOKEN" })

should be

await secretClient.accessSecretVersion({ name: "projects/my-project/secrets/TELEGRAM_TOKEN" })

I just encountered the same problem and I personally had to add /versions/latest after specifying the project name in the secret name.

await secretClient.accessSecretVersion({
  name: "projects/my-project/secrets/TELEGRAM_TOKEN/versions/latest"
})