Skip to content

Commit

Permalink
🔒️ fixing issue with service accout key in secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
chatondearu committed Apr 5, 2024
1 parent 21fef73 commit 35c3f8e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/server/gsheets/accessors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,12 @@ export class Sheet<
return tryNTimes(
async () => {
if (hasGSheetsAccess()) {
const key = process.env.GCP_SERVICE_ACCOUNT_PRIVATE_KEY || ""
// Authentication
const doc = new GoogleSpreadsheet(process.env.GSHEET_ID)
await doc.useServiceAccountAuth({
client_email: process.env.GCP_SERVICE_ACCOUNT_CLIENT_EMAIL || "",
private_key: process.env.GCP_SERVICE_ACCOUNT_PRIVATE_KEY || "",
private_key: key.replace(/\\n/g, "\n"),
})
await doc.loadInfo()
return doc.sheetsByTitle[this.sheetName]
Expand Down

0 comments on commit 35c3f8e

Please sign in to comment.