Skip to content

[BUG]: diff_url always return 404 #2820

@theunreal

Description

@theunreal

What happened?

Simply trying to access a diff of a PR, but it always return 404(works only for public repos).
All other APIs that require authentication work (List pull request for example).
Only when trying to access the diff URL,it doesn't, and return 404.
It is accessible using the browser under authenticated session, but the API - 404.

Any idea?

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
    if (req.method === 'POST') {
        const payload = req.body;

        if (payload.action === 'opened' && payload.pull_request) { // Process only 'opened' PR events
            const diffUrl = prData.diff_url;

            console.log(`New PR opened: #${prNumber} in ${repoOwner} ${repoName}`);
            console.log(`Diff URL: ${diffUrl}`);

            try {
                const diffResponse = await octokit.request({
                    method: 'GET',
                    url: diffUrl,
                    headers: {
                        'Accept': 'application/vnd.github.v3.diff' // Request raw diff
                    }
                });
}

Versions

"octokit": "^4.1.2",

Relevant log output

curl -H "Authorization: token github_pat_my_token_here" https://github.com/theunreal/codesight/pull/11.diff
Not Found%

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: TriageThis is being looked at and prioritizedType: BugSomething isn't working as documented

    Type

    No type

    Projects

    Status

    🔥 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions