Next.js 从边缘函数更改为 Netlify 上的无服务器函数

huangapple go评论58阅读模式
英文:

Next.js change from edge function to serverless functions on Netlify

问题

在将Next.js项目部署到Netlify时,默认情况下API路由会被部署为边缘函数。我该如何切换以便它们被部署为无服务器函数?

我已经查阅了所有的文档,但找不到关于这个的任何信息。

英文:

When deploying a Next.js project to Netlify, API routes are deployed as Edge Functions by default.
How can I switch so they are deployed as serverless functions?

I've looked through all the docs I can't find anything about this.

答案1

得分: 1

截止到2023年2月,这是不正确的。Next.js API 路由是通过Netlify Functions而不是Netlify Edge Functions部署的。

来源:https://github.com/netlify/next-runtime#generated-functions

引述:

Next.js Runtime通过生成三个Netlify函数来处理尚未预渲染的请求。这些函数是___netlify-handler(用于SSR和API路由)...

英文:

As of February 2023, that is untrue. Next.js API routes are deployed using Netlify Functions and not Netlify Edge Functions.

Source: https://github.com/netlify/next-runtime#generated-functions

Quoting:

> The Next.js Runtime works by generating three Netlify functions that handle requests that haven't been pre-rendered. These are ___netlify-handler (for SSR and API routes)...

huangapple
  • 本文由 发表于 2023年2月8日 20:01:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/75385520.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定