Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Embed component video attachment file got error AccessDenied when showed #520

Open
chenhuanghui opened this issue Sep 21, 2023 · 10 comments

Comments

@chenhuanghui
Copy link

Description

I have file video attachment on notion page as embed component, and using react-notion-x to render content.
But I got error as below:

<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>RESB8AZZZ1BMMPYY</RequestId>
<HostId>n8IIFPpQZblmwRVv2QUpx/RfULLwGXauji9s52oaKfSlhn1O/pdTb7umphLSQd1Mk1yZ4+FwDf8=</HostId>
</Error>

Notion Test Page ID

This is my notion page ID: https://www.notion.so/casavn/test-embed-page-046f035b59f346d0bdf59f1175f94186?pvs=4

React-Notion-X render
https://www.casaholding.vn/046f035b59f346d0bdf59f1175f94186

@hirvesh
Copy link

hirvesh commented Oct 6, 2023

Having the same issue - is this due to an update from Notion side?

@0xFloyd
Copy link

0xFloyd commented Oct 19, 2023

Im also getting this error, didnt in the past

@vader1359
Copy link

Anyone figured out a work around this?

@brunomorency
Copy link

Notion now exposes uploaded content through expiring links. You either need to cache those filees, fetch a fresh link from Notion every time your page loads or, in the Notion UI, embed files as external links rather than uploading them on Notion.

@jpprakash4260
Copy link

Does anyone know any alternative way or method to bypass these expiring links?

@GridexX
Copy link

GridexX commented Jan 15, 2024

There should be an update on the Notion side, the video is correctly showing up on my side

@dennisrcao
Copy link

Yup same issue here, ive got an uploaded video to a notion page (thats been published) when I use the API to read off of it then re-render the page, everything loads except for the embedded videos. And on the DOM of the re-rendered page there is a <video> component but when I go to the value of the src parameter (which is the url it's trying to load ).
image

I get this error.
Essentially the same issue that the OP is saying.

@kyeah
Copy link

kyeah commented Jan 6, 2025

It seems possible to retrieve a new URL when needed by providing the following format to notion.so/signed:

https://notion.so/signed/${encodedUrl}?table=block&id=${videoBlockId}&spaceId=${spaceId}

The built-in notion-x CSS styling seems like it needs updates to support this method (or maybe my site is applying some custom styling.)

Regardless, I was able to get the videos to show up by editing the block video sources before passing it to the NotionRenderer.

export default function updateVideoUrl(block) {
  if (block.type != "video") {
    return;
  }

  const s3Url = block.properties.source[0][0];
  if (s3Url.includes("notion.so/signed")) {
    return;
  }

  const encodedUrl = encodeURIComponent(s3Url);
  block.properties.source[0][0] = `https://notion.so/signed/${encodedUrl}?table=block&id=${block.id}&spaceId=${block.space_id}`;
}

See this branch: spacetypeco/blogs@0e82fbe...mapVideoUrl

I didn't test this thoroughly so YMMV. This was with a public page.

@kyeah
Copy link

kyeah commented Jan 7, 2025

Looks like this is the root cause, so once it's merged this will be resolved:

#596

@worgho2
Copy link
Contributor

worgho2 commented Jan 10, 2025

Thanks @kyeah for mentioning the open PR, by the way a possible workaround is to overrive the existing addSignedUrls function. Check this out: #580 (comment)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants