transitive-bullshit / nextjs-notion-starter-kit

Deploy your own Notion-powered website in minutes with Next.js and Vercel.
https://transitivebullsh.it/nextjs-notion-starter-kit
MIT License
6.17k stars 5.23k forks source link

Notion Image do not load #463

Open AnshumanFauzdar opened 1 year ago

AnshumanFauzdar commented 1 year ago

Description

image Image do not load up and throw {"message":"Something went wrong."} error.

Notion Test Page ID

bd999537dba44d68be67cbcf11ee6199

heypratik commented 1 year ago

Did you add allowed image domains in next site config?

You can refer - https://stackoverflow.com/questions/66533981/next-image-configuration-in-next-js-config-file

AnshumanFauzdar commented 1 year ago

@heypratik It was working without this image domain, is there any upgrade or dependency introduced which caused this issue?

JYeop commented 1 year ago

Same thing happens.

image

The image urls api gives are invalid. ex) https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Fs%2F2f3dca95-eec5-4117-b336-6a748a5ddddd%2FUntitled.png%3Ftable%3Dblock%26id%3D24640f83-bca7-46e9-b096-388e696fa8c2%26expirationTimestamp%3D1679017640323%26signature%3DhTyG5u5jozwOeA33Rd3qxpyU1FoZw81tqC_Lh84zLBU?table=block&id=24640f83-bca7-46e9-b096-388e696fa8c2&cache=v2

image domains are allowed in next site config.

JYeop commented 1 year ago

I found the reason. See https://github.com/NotionX/react-notion-x/issues/441

adayush commented 1 year ago

It fixed for me when I added file.notion.so in next.config.js in the domains array inside images.

ZuopieziChen commented 1 year ago

It fixed for me when I added file.notion.so in next.config.js in the domains array inside images.

still not work for me.

RichardS0268 commented 1 year ago

I am facing the same problem. Images on my blog do not show and when I try to access the src from browser it raise {"message":"Something went wrong."}. One example page is https://www.richardsong.space/l2-risk where images in original notion page do not show. I have tried method mentioned by @adayush, it cannot work for me😥

congnt24 commented 1 year ago

I have the same problem, the domain of the image is "file.notion.so" and when I access that image URL, it always returns {"message":"Something went wrong."} I try to "file.notion.so" domain to next.config.js but it doesn't work

0xFloyd commented 1 year ago

same issue here. any update here? this is a pretty big issue IMO. It seems to only be private page images

AnshumanFauzdar commented 1 year ago

@0xFloyd I didn't change anything and now its working as usual.

Gumball12 commented 1 year ago

It works for now

minesunny commented 1 year ago

I am facing the same problem. Images on my blog do not show and when I try to access the src from browser it raise {"message":"Something went wrong."}. One example page is https://www.richardsong.space/l2-risk where images in original notion page do not show. I have tried method mentioned by @adayush, it cannot work for me😥

notion using Amazon’s cdn,its‘ period time is about one day(24hours),the static resources like src in html only Effective within 24 hours

minesunny commented 1 year ago

I am facing the same problem. Images on my blog do not show and when I try to access the src from browser it raise {"message":"Something went wrong."}. One example page is https://www.richardsong.space/l2-risk where images in original notion page do not show. I have tried method mentioned by @adayush, it cannot work for me😥

notion using Amazon’s cdn,its‘ period time is about one day(24hours),the static resources like src in html only Effective within 24 hours

I am facing the same problem. Images on my blog do not show and when I try to access the src from browser it raise {"message":"Something went wrong."}. One example page is https://www.richardsong.space/l2-risk where images in original notion page do not show. I have tried method mentioned by @adayush, it cannot work for me😥

I wanted to set static resources cnd cache lessthan 24hours,so that images' url can be valid,but I failed;Then,you can set a schedule task(less than 24 hours) to redeloy your project ,so that can refresh static resources

minesunny commented 1 year ago

If you deployed on local,see this https://github.com/transitive-bullshit/nextjs-notion-starter-kit/issues/463#issuecomment-1632029991;If you deployed on vercel,I can explain why notion image can't load ? Vercel using next.js as Server render, For free personal,the timeout of function getStaticProps with limited in 10s,if some request timeout,it would use resource which last compiled (hold old timeStamp image url);seeing this image; I configed navigationLinks,navigationStyle in site.config.ts and caused that problem. navigationStyle with not default will request more notion's api, you can solve this problem from here.

image
sivannavis commented 11 months ago

How did you guys solve it? I'm facing the same thing it only works when I refresh the page or switching the light mode, but it never works the first time you visited it, such a bad user experience : (

For example, one of my failing image address is https://www.sivan.fun/_next/image?url=https%3A%2F%2Fwww.notion.so%2Fimage%2Fhttps%253A%252F%252Ffile.notion.so%252Ff%252Fs%252F0645a5ce-1e52-4aef-977b-e05a606611a4%252FUntitled.png%253Fid%253D13c21c56-8a17-44dd-87fa-9818614d7551%2526table%253Dblock%2526spaceId%253Db74133af-844e-4972-b144-c12554ed8914%2526expirationTimestamp%253D1698350400000%2526signature%253DYCU8p7ySl0bT7GcabU1W0wVmJbVVOz6C6TKJFHUxTd8%3Ftable%3Dblock%26id%3D13c21c56-8a17-44dd-87fa-9818614d7551%26cache%3Dv2&w=3840&q=75

And when I open it in new page, it shows:

400: BAD_REQUEST
Code: INVALID_IMAGE_OPTIMIZE_REQUEST
ID: iad1::b6d7n-1698260486516-913b8605f5e4
jacksongoode commented 7 months ago

Getting something similar in my deployment recently. I wonder if Notion changed some header in their image responses?