Skip to content
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

Cost marking all components edge rundtime? #1303

Closed
osseonews opened this issue Feb 24, 2024 · 2 comments
Closed

Cost marking all components edge rundtime? #1303

osseonews opened this issue Feb 24, 2024 · 2 comments

Comments

@osseonews
Copy link

We have forked this repo and added many features for our Shopify store, and were planning on launching it soon. However, we were concerned as every Server component here for every App Router page is marked as: export const runtime = 'edge';.

Does this mean that every page will count as an edge runtime invocation? If so, as Vercel limits Edge invoccations wouldn't that quickly rack up substantial costs on any website with a decent amount of traffic even on the Pro plan? I mean every time any person or bot (which cause the most traffic) visits the site and calls a product page, there will be Edge invocations. If you have let's say 1,000 products and get 1,000 visits a day, that's 1 million edge invocations a day! Is this accurate or I am misunderstanding what an edge invocation is, so 1,000 products is only one invocation because the Page is the same code for each product?

@leerob
Copy link
Member

leerob commented Feb 24, 2024

We are moving away from the Edge Runtime here -> #1236

Server Components don't have to run dynamically, they can instead by rendered statically during the build. If you do not want any dynamic parts of your application that require running compute at runtime, you can remove that functionality from the template. For example, we use dynamic rendering here to read cookies and understand what is saved in the user's cart.

@leerob leerob closed this as completed Feb 24, 2024
@osseonews
Copy link
Author

osseonews commented Feb 24, 2024

So basically any route that requires some dynamic functionality, like the cart, should be marked as runtime=edge, and everything else can just be static? I'm also confused, in your pull request, you remove the Suspense around Related Products, in app/product/[handle]. But, you are doing a data fetch request in the Related Products component, so why is suspense removed?

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

No branches or pull requests

2 participants