octokit / app.js

GitHub Apps toolset for Node.js
MIT License
158 stars 34 forks source link

[BUG]: Resource not accessible by integration while accessing installation resource #522

Open RajuGangitla opened 7 months ago

RajuGangitla commented 7 months ago

What happened?

import { App, Octokit } from "octokit"

const app = new App({
    appId: process.env.GITHUB_APP_ID,
    privateKey: `-----BEGIN RSA PRIVATE KEY-----
    .......................
    -----END RSA PRIVATE KEY-----`,
        oauth: {
        clientId: process.env.GITHUB_CLIENT_ID,
        clientSecret: process.env.GITHUB_CLIENT_SECRET,
    },
  });

async getConnected(user, installId: string) {
        try {

            const octokit = await app.getInstallationOctokit(Number(installId));

            const reposResponse = await octokit.request(`GET /user/installations/${installId}/repositories`, {
                installation_id: installId,
                headers: {
                    "X-GitHub-Api-Version": "2022-11-28",
                },
            })

            return reposResponse.data

        } catch (error) {
            const handledError = CustomErrorHandler.handle(error)
            throw handledError
        }
    }
    {
    "statusCode": 500,
    "message": "Resource not accessible by integration",
    "error": "Internal Server Error"
}

Versions

    "octokit": "^3.1.0",
             node   :  v20.9.0

Relevant log output

No response

Code of Conduct

github-actions[bot] commented 7 months ago

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀