简体   繁体   English

了解将 next.js 与 firebase 托管集成时如何计算服务器时间?

[英]understanding how server-time is calculated when integrating next.js with firebase-hosting?

I want to make a general refactor to my app that will mover from react.js (client-side) to next.js with SSR, where I will use the following props to pre-render data... and my app pages,我想对我的应用程序进行一般重构,它将使用 SSR 从 react.js(客户端)移动到 next.js,我将在其中使用以下道具来预呈现数据......和我的应用程序页面,

 export async function getServerSideProps(context) { return { props: {}, // will be passed to the page component as props } }

how to does firebase charge for the SSR? firebase的SSR怎么收费? since it is not a cloud function, technically for next.js app to be hosted on firebase there should be a server time, as I understood the idea, how is this server time goin to be calculated in the context of the hosting and out of the context of cloud functions, please elaborate if I misunderstand the concept behind ssr with next.js and firebase.因为它不是云 function,从技术上讲,next.js 应用程序要托管在 firebase 上,应该有一个服务器时间,据我所知,这个服务器时间是如何在托管上下文和上下文之外计算的云功能,如果我误解了 next.js 和 firebase 背后的概念,请详细说明。

Firebase Hosting on its own will never execute any of your code on its servers. Firebase 自行托管永远不会在其服务器上执行您的任何代码。

If you run a web app that performs Server-Side Rendering on Firebase, you are using Cloud Functions or Cloud Run to execute that code for which Firebase Hosting provides convenient connectors.如果您运行在 Firebase 上执行服务器端呈现的 web 应用程序,则您正在使用 Cloud Functions 或 Cloud Run 来执行该代码,Firebase 托管为其提供了方便的连接器。

So if you get the server-side timestamp in SSR, that's also where any billing for such server-side code comes from.因此,如果您在 SSR 中获得服务器端时间戳,这也是此类服务器端代码的任何计费来源。 Also see this line from the Firebase documentation on using web frameworks :另请参阅 Firebase 文档中有关使用 web 框架的这一行:

Prerequisites先决条件
... ...

  • Optional: Billing enabled on your Firebase project (required if you plan to use SSR).可选:在您的 Firebase 项目上启用计费(如果您计划使用 SSR,则需要)。

For a good primer on hosting server-side dynamic content on Firebase Hosting, see the documentation on serving dynamic content and host microservices using Firebase Hosting .有关在 Firebase 托管上托管服务器端动态内容的入门读物,请参阅有关使用 Firebase 托管提供动态内容和托管微服务的文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firebase 托管“重写”以访问 Google Cloud Run 上的 Next.js 应用程序 - Firebase Hosting "rewrites" to Access Next.js App on Google Cloud Run Next.js Firebase 除索引外的所有主机都出现 404 错误。html - Next.js Firebase Hosting 404 error on all except index.html Firebase 使用 Next.js 推送通知 - Firebase Push Notifications with Next.js Next.js 与 Firebase 远程配置 - Next.js with Firebase Remote Config Next.js 和 Firebase 在尝试读取一个文档时不断出现序列化错误 - Next.js and Firebase keep getting serialization error when trying to read one doc Next.js 应用程序在尝试实现谷歌 firebase 身份验证时崩溃 - Next.js app crashes when attempting to implement google firebase authentication 尝试在 Next.JS web 应用程序中上传文本/图像时出现运行时错误 - I have a run time error when trying to upload text/image in Next.JS web app Firebase 在自己的服务器上托管 - Firebase Hosting on own server Not able to fetch data from Firebase Firestore SHOWS ERROR in NEXT.JS using Firebase SDK Firebase v9 - Not able to fetch data from Firebase Firestore SHOWS ERROR in NEXT.JS using Firebase SDK Firebase v9 如何让 Firebase 托管模拟器在本地为 Vite 开发服务器提供服务? - How to get Firebase hosting emulator to serve a Vite dev server locally?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM