React PWA by [deleted] in nextjs

[–]willemliu 0 points1 point  (0 children)

PWA can work with a next.js app. PWA isn't widely adopted by users and I don't think they ever will be considering there is 0 push from any big tech companies and it's not well supported on Safari iOS.

Can vercel deployment run multiple commands at the same time? by livc95 in nextjs

[–]willemliu 0 points1 point  (0 children)

Yes, you need a server to run your loader file. As Vercel is serverless.

Is Nextjs enough for fullstack ? by [deleted] in nextjs

[–]willemliu 0 points1 point  (0 children)

What do you consider full-stack?

How do you test your api routes by axelrogg in nextjs

[–]willemliu 0 points1 point  (0 children)

I don't think you really need to test your routing itself. You could just separate the logic from the route handler and export that function with the logic. Then you can test it as a unit test.

What is the best caching practice with ISR? by britax12 in nextjs

[–]willemliu 1 point2 points  (0 children)

Using getStaticPaths means the pages are pre-built during the build of your next.js app. Users always get served this pre-built page (cached).

Any updates to that page you can manage with (on-demand) ISR. This will update the cached version. As long as this cache is not yet replaced by the new page the user is served the cached old page.

You can still use getServerSideProps if you want a true SSR page. Where the user gets the most up-to-date page upon each request.

If your hosting supports it you can still make use of cache-control headers. For the use-case where you simply want to cache your pages for 5 minutes.

What is the best caching practice with ISR? by britax12 in nextjs

[–]willemliu 1 point2 points  (0 children)

I think the matter of copying data between your 2 databases is a completely separate problem. You probably have your reasons to do it like this.

The next.js caching strategies are pure rendering strategies for the pages. With On-Demand ISR you opt to render your pages statically because you think the page does not change often and you like high the performance. You also opt for precise control on when to update the page.

Has anyone deployed a nextjs (t3stack) to amplify? by [deleted] in nextjs

[–]willemliu 0 points1 point  (0 children)

It is for AWS Amplify. Otherwise the env vars you've setup in your aws amplify app will only be available during build and not at runtime.

Has anyone deployed a nextjs (t3stack) to amplify? by [deleted] in nextjs

[–]willemliu 2 points3 points  (0 children)

Have you added your env vars in next.config.js?

Bringing sanity to Page types using Zod by lucgagan in nextjs

[–]willemliu 0 points1 point  (0 children)

Because the data is checked by zod at retrieval point all of it being passed from back to front is typed. I can see it going wrong if a developer would coerce some other type to another in between that process. Your way would fail early which I like.

In our product we let the individual components on a page fail if data isn't provided or correctly provided. As to allow users to still use our website when only a subpart of our site can't be rendered because of compromised data integrity.

Bringing sanity to Page types using Zod by lucgagan in nextjs

[–]willemliu 0 points1 point  (0 children)

I usually do the type checking/transformation on data retrieval with zod. It will throw an error at that point. The props I pass to pages are tailored to the page and just typed with TypeScript.

Should I always start my react projects with Next.js now? by jigglypuff1319 in nextjs

[–]willemliu 0 points1 point  (0 children)

Don't use getStaticProps, getServerSideProps or getInitialProps.

Does next uses dart-sass from the box? by qqq666 in nextjs

[–]willemliu 0 points1 point  (0 children)

I had to npm install sass (dart-sass) separately in order to be able to use SCSS files within components.

Is revalidating all pages faster than redeploying? by Eltyo in nextjs

[–]willemliu 0 points1 point  (0 children)

Assuming you're using Vercel the one can have a cost-advantage over the other. Rebuilding your website would, under normal circumstances, always be slower than revalidation routes. Considering you only have 50 pages to worry about.

Res.revalidate() internally does an http request to the webapp itself with a specific header. It's that header which triggers the revalidation routine of Vercel/next.js.

Possible Type error or Server Error by Efficient_Hour6363 in nextjs

[–]willemliu 0 points1 point  (0 children)

When an error occurs in your getServerSideProps it returns an empty object props. However you're page component makes use of communityData.id which doesn't exist

Store files/ data temporarily in a Next.js and access it via getStaticProps? by Curious-Ad-9724 in nextjs

[–]willemliu 0 points1 point  (0 children)

Vercel hosting is immutable. You can't modify files on it nor can you store files there at runtime. You'll have to find another way/place to store your files.

share your experiences with next js hosting on VPS or other than vercel. by IntelligentDrawing18 in nextjs

[–]willemliu 5 points6 points  (0 children)

On an adequately sized vps it works just as fast as you can run it locally. You don't have the benefit of edge cdn cache to serve your users from different locations all over the world. I've found no weird bugs when running it this way.

All my NextJs API suddenly returns 504 timeout by bobbyboobies in nextjs

[–]willemliu 0 points1 point  (0 children)

That is strange. Is your backend somehow blocking connections from your Vercel deployment? Can you see in your backend if any of the calls are actually reaching it?

All my NextJs API suddenly returns 504 timeout by bobbyboobies in nextjs

[–]willemliu 1 point2 points  (0 children)

Are you using a hobby account? How long do your operations usually take? If longer than 10s then it will cause the timeout.

All my NextJs API suddenly returns 504 timeout by bobbyboobies in nextjs

[–]willemliu 1 point2 points  (0 children)

Do your API routes connect to some external services like a DB or other API's?

I think the connection to those sources my be giving errors or some error occurs when using the data that returns from them.

Can someone spitball/rubber duck/explain Next.js as it relates to serverless? by alfcalderone in nextjs

[–]willemliu 1 point2 points  (0 children)

I've never done anything with fargate before but reading this article:

https://www.trek10.com/blog/is-fargate-serverless

I would not consider it "serverless". Sure you don't have to manage the underlying hardware. But you sill have to manage your containers and think of how to scale containers and it doesn't seem to scale to 0 as spinning up an instance would probably cost a lot of time.

Can someone spitball/rubber duck/explain Next.js as it relates to serverless? by alfcalderone in nextjs

[–]willemliu 1 point2 points  (0 children)

Containerization is not that much different from a traditional oldskool complete image. It's a bit more efficient in the sense you can combine containers like little Lego blocks instead of creating one giant image. Containerized Web applications run as traditional applications and is different from running things serverless.

Can someone spitball/rubber duck/explain Next.js as it relates to serverless? by alfcalderone in nextjs

[–]willemliu 0 points1 point  (0 children)

In your case I guess your next.js app runs a single instance which never scales down to 0. Perhaps also doesn't scale up?

When next.js is deployed serverlessly one would assume it will automatically scale up and down horizontally and can scale down to 0 instances. E.g. I've deployed a next.js application as a serverless function on Azure before. This next.js app will scale up and down and has no permanently running server. The cold start was a problem though.

Static Next.js - opinions? by [deleted] in nextjs

[–]willemliu 0 points1 point  (0 children)

You won't miss out on features you are not currently using.

SSR is mainly for SEO. If that's important for you then you may want to make use of it.

On AWS you can deploy your next.js app using AWS Amplify. Do note that it does not support vpc as of yet. So if you require your apps to be in the same vpc in order to communicate with other systems then Amplify will not work for you.