NotionX / NotionX/react-notion-x

Images from Signed URL returns 403

Open
#476 7 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

Images accessed with signed url results in 403 now.

Notion Test Page ID

Currently using the function below.

function getPageCover(
  pageData: ExtendedRecordMap,
  pageBlock: PageBlock
): string | null {
  const cover = pageBlock.format?.page_cover;

  if (cover) {
    if (!cover.startsWith("http")) {
      return `https://www.notion.so${cover}`;
    }

    return pageData.signed_urls[pageBlock.id];
  }

  const images = getDirectChild(pageData, "image") as ImageBlock[];
  if (images.length === 0) {
    return null;
  }
  const image = images[0];

  return pageData.signed_urls[image.id];
}

It returns signed url, such as https://file.notion.so/f/s/cceaadce-b934-4469-a976-1639abc31c16/cover_tech_blog.png?id=cdce9a22-28db-4759-b55b-3eca64d17d6d&table=block&spaceId=9b56c2e3-24a2-45c2-b3f7-92eb37529384&expirationTimestamp=1682528539982&signature=TaFx_XF7gC__IrWAbK4kn8Sf8yiT9g5IirYlzCKuEPQ

However, I cannot access those images on incognito mode.

I can provide more URLs when the above URL is expired. Please check this issue.

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

Start with the getPageCover function shown in the issue and reproduce access to its returned signed URL in an incognito browser. Compare the behavior for page covers and direct child images, then trace how pageData.signed_urls is populated. Done means the affected image URLs can be accessed as expected without relying on an authenticated browser session.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.