Skip to content

Commit

Permalink
Fix for issue with private key no longer working as a buffer
Browse files Browse the repository at this point in the history
So with the bump of @octokit/auth-app from v6.* -> v7.* it bumped its
own dependency of universal-github-app-jwt from v1.* -> v2.*

The universal-github-app-jwt v2 has introduced some work that replaces
newlines within private keys - https://github.com/gr2m/universal-github-app-jwt/blob/d52064d3395a02363b6f80afeeb5d91e0a5f2040/index.js#L17

This work looks like it came in in v2.1.1 - gr2m/universal-github-app-jwt#96

Essentially what this means is with the latest version the privateKey
must be a string rather than a buffer.

This code fixes this issue
  • Loading branch information
feedmypixel committed Jan 22, 2025
1 parent 20b77a0 commit c340e1e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/helpers/oktokit.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import { graphql as octokitGraphql } from '@octokit/graphql'

const auth = {
appId: config.get('github.app.id'),
privateKey: Buffer.from(config.get('github.app.privateKey'), 'base64'),
privateKey: Buffer.from(
config.get('github.app.privateKey'),
'base64'
).toString('utf8'),
installationId: config.get('github.app.installationId')
}

Expand Down

0 comments on commit c340e1e

Please sign in to comment.