NotionX / NotionX/react-notion-x

Pre-rendering pages on Github Actions causes 403 Error

Open
#487 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5.4k
Forks
645
PR merge metrics
No merged PRs in 30d

Description

Description

The error below occurs when I pre-render my website using getStaticPaths on GitHub Actions.
Locally, it works fine 4/5 times.

Notion Test Page ID

Error on notion.getPage(a1c4c4eb2a8842e9a53a8d642b5da034)

HTTPError: Response code 403 (Forbidden)
    at Request.<anonymous> (/home/fakename/runner-two-one/_work/fakename-repo/fakename-repo/node_modules/.pnpm/got@11.8.6/node_modules/got/dist/source/as-promise/index.js:118:42)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_NON_2XX_3XX_RESPONSE',
  timings: {
    start: 1684765933516,
    socket: 1684765933520,
    lookup: 1684765933522,
    connect: 1684765933529,
    secureConnect: 1684765933551,
    upload: 1684765933553,
    response: 1684765933570,
    end: 1684765933590,
    error: undefined,
    abort: undefined,
    phases: {
      wait: 4,
      dns: 2,
      tcp: 7,
      tls: 22,
      request: 2,
      firstByte: 17,
      download: 20,
      total: 74
    }
  }
}

Do I maybe need to add an authToken or something else?
I tried to use the authToken and the active user like it is described here: LINK

That did not work and as far as I know, the authToken changes and I can't automatically fetch it.
Is there any other way to do this?

Thank you very much!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report identifies getStaticPaths and notion.getPage(...) as the relevant entry points, with the failure occurring during GitHub Actions pre-rendering. Start by reproducing the 403 in that workflow and compare it with local runs, then review the documented private-page authentication setup. Done means the workflow can pre-render the page without the reported 403.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, nextjs, typescript
Domain
ci-cd, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.