gpt4 book ai didi

reactjs - NextJs : The Serverless Function exceeds the maximum size limit of 50mb

转载 作者:行者123 更新时间:2023-12-04 12:56:21 25 4
gpt4 key购买 nike

我是 NextJs 的新手,在尝试将我的项目部署到 Vercel 时,出现以下错误:

Error! The Serverless Function "api/auth" is 50.55mb which exceeds the maximum size limit of 50mb.


我花了很多时间试图找到正确的答案,但我没有找到任何答案。这是我正在发出的 api 请求的代码:
const { auth: adminAuth } = require("firebase/admin");

export default async function auth(req, res) {
const tokenId = req.query.token;
return new Promise((resolve) => {
adminAuth
.verifyIdToken(tokenId)
.then((user) => {
res.json(user);
resolve();
})
.catch(() => {
res.status(302).send("Invalid authentication");
resolve();
});
});
}
如果有人可以帮助我,我将不胜感激,谢谢大家!

最佳答案

我一直在处理同样的问题。似乎在捆绑无服务器功能时 vercel 正在拉入项目中的所有 Assets 。所以 50.55MB 可能是您当前整个构建的大小。我正在研究如何只在 vercel.json 中包含某些文件,但到目前为止还没有弄清楚如何做到这一点。现在,您可能只需从公共(public) Assets 中删除一些文件即可达到限制。

关于reactjs - NextJs : The Serverless Function exceeds the maximum size limit of 50mb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66632218/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com