#30,000 pages statics

64 messages · Page 1 of 1 (latest)

dull spoke
#

I have a project with approximately 30,000 pages. Vercel couldn't generate all the statics within the build time. What would be the alternatives to generate all these pages statically?

shy mirage
#

Hi @dull spoke, Are you hitting the build time limit of 45mins?

#

What is the error/log you're getting?

peak tendon
#

CSR when you render page on client using JS which may negatively impact SEO
SSR which renders page on server and serves ready page that might be slower if there are intensive stuff going on

Can you tell more about your use case?

dull spoke
#

Does Netlify have the same limitation?

shy mirage
#

Are you using getStaticPaths? I agree with Herob we need more info about your situation

dull spoke
#

That's right, I'm using getStaticPaths.

shy mirage
#

Can you show us what your getStaticPaths function looks like or share a repo

dull spoke
#

I'm pulling the urls from a static json so I don't have to make an api call.

peak tendon
#

If SSR won't do, try CSR (client-side rendering)

#

And load JSON into your app (after modifying it)

dull spoke
#

The performance using SSR is great, but I would really like to use it as an SSG.

peak tendon
#

This works for SSR only

#

But it's another issue

shy mirage
#

@dull spoke does this build locally for you?

#

That's a lot of routes 🫣

dull spoke
shy mirage
#

What happens when you build in dev? and out of curiousity what was the error from vercel deployment logs?

dull spoke
#

Build Failed
Your deployment's build step did not complete within the maximum of 45min

shy mirage
dull spoke
#

Time-based only

shy mirage
#

For the amount of pages you have I think SSR is your option. The build time is just too big

dull spoke
#

So I think that would be the way out.
It will generate statically on demand, so it will deliver SSR from the second access.

And I will be able to update on demand, using ISR.

In other words, at build time it will be SSR, but the next accesses will be delivered SSG. Am I correct in my analysis?

shy mirage
#

Looking into this...

shy mirage
peak tendon
#

I think you might talk about this 🤔

dull spoke
#

I know ISR well in NextJS, I have a project with more than 3 million pages.

I'm doing this 30,000 page MVP to test ASTRO and maybe migrate this big 3 million page project.

vivid halo
#

My only question. What in the world kind of site has 3 million pages?

dull spoke
#

By the way, I was wrong, it's 5 million.

vivid halo
#

Wow

young crater
#

How often are these pages changed? Using SSR + Cache Control headers is a middle ground, but if you have heavy traffic and a short TTL the cost of serverless might not work

flat comet
#

@orchid plover

orchid plover
#

Are you using codegen to create the static paths @dull spoke ? or how are you doing that?

dull spoke
dull spoke
orchid plover
#

I was referring to this:

#

Is this file made via codegen of some sort?

dull spoke
# orchid plover

This was an attempt to use only SSG by passing all urls to be built at build time. In the case where the project is an MVP, I built this json myself locally.

I have the CSV of all the slugs and I created a script to generate this json.

orchid plover
#

were you able to get the full build to run locally?

dull spoke
orchid plover
#

So just to reiterate, what is your main issue, the time it takes or it's not working on vercel or something?

viral holly
#

how long is the typical per-page rendering duration?

#

for context, rendering is one-half of process, the other (more inefficient) half is compiling md, mdx, jsx, astro into css and javascript

dull spoke
orchid plover
#

I'm curious to know what astro plugins/extensions you're using to get the build time so high

dull spoke
#

I now looked at the terminal logs and it takes an average of 400ms per page.
fazendo chamada no supabase

orchid plover
#

what does your page template and astro config look like?

peak tendon
#

I wonder if building locally and sending these pages manually would do 🤔

#

Of course, if it's possible with vercel

viral holly
#

yes, vercel cli has a --prebuilt flag

orchid plover
#

if i was in your situation and I really wanted SSG, i'd probably do some codegen for a "fake" ISR that is actually just SSG.

#

so I could take the time to build the first pass of all 5 million pages