Skip to content

Using getStaticProps for fetching images hosted on Notion? #8

Closed
@spencerwooo

Description

@spencerwooo

Hi there, apologies for posting this random question here, but I was curious about how you overcame the issue for rendering images hosted on Notion and also using next/image for optimisation? (As I myself ran into a similar problem when switching to Notion's public API for blog hosting.)

  • The problem I ran into was that Notion's public API responds with URLs of images hosted on Notion that are short-lived - they would expire after a certain amount of time (seems to be 1 hour).
  • This means that there would exist a possible time span where ISR is still revalidating but the images have already expired, resulting in broken images for visitors accessing the site during this particular time - and I've personally ran into this for a couple of times over on my site.
  • It also implies that next/image would have to optimise a whole lot of images with different URLs while they are still the same one in reality - leading to an email from Vercel telling me that I have gone over my limit for image optimisation.

It was not until Next.js 12.1 (released literally yesterday) before we could on-demand ISR with webhooks (On-demand Incremental Static Regeneration). So I was curious about if you had some solutions to this issue without on-demand ISR?

My workaround was that I had to resort to using getServerSideProps without image optimisation for serving fresh images. But I skimmed through your repo and found that you were still using getStaticProps, and hence this question ;)

And thanks for the awesome railway.app, I'm loving it!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions