Skip to content

Fix for getting signed urls #334

New issue

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

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

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

Conversation

pbteja1998
Copy link
Contributor

@pbteja1998 pbteja1998 commented Jul 27, 2022

Notion API is throwing an error when a signed URL is requested for page cover. Removing it solves the problem.

Resolves #331

@vercel
Copy link

vercel bot commented Jul 27, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
react-notion-x ✅ Ready (Inspect) Visit Preview Jul 27, 2022 at 4:24PM (UTC)
react-notion-x-minimal-demo ✅ Ready (Inspect) Visit Preview Jul 27, 2022 at 4:24PM (UTC)

@transitive-bullshit
Copy link
Member

Won't this break user-uploaded page covers which need to be signed?

@pbteja1998
Copy link
Contributor Author

I am using this patch in feather.so and so far it is working well even for user uploaded covers. My guess is user uploaded covers were not needed to be signed in the first place.

@pbteja1998
Copy link
Contributor Author

I just tried it locally, the covers are showing up even if they are user-uploaded.

@remorses
Copy link
Contributor

remorses commented Jul 27, 2022

Your PR still fails with pages like this one (the link is using code from your pr)
https://react-notion-x-minimal-demo-git-fork-pbteja1998-patch-2-saasify.vercel.app/5af3d63c840e458e92c09c2ec6cd71b3

The problem is that the signed urls endpoint no longer accepts any host and only accepts domains with host secure.notion-static.com (and moaybe also other hosts i dont know about)

This means that if you have any embed on the page addSignedUrls will fail because it passes the embed url to the endpoint (in the page about it passes the loom video url)

In simple cases your pr works because it does not pass the cover url to signed urls endpoint

@pbteja1998
Copy link
Contributor Author

@remorses can you check your example now?

@normdoow
Copy link
Collaborator

normdoow commented Aug 5, 2022

Is this a different way to fix the same problem as this fixes? #332

@pbteja1998
Copy link
Contributor Author

@normdoow yes

@transitive-bullshit
Copy link
Member

Going with #332 over this PR as I think it's the safer option.

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

Successfully merging this pull request may close these issues.

NotionAPI getSignedfileUrls error HTTPError: Response code 400 (Bad Request)
4 participants