You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my Nuxt 2 application, I'm attempting to use serverless functions with Firebase, but I am encountering an issue with the size limit. After adding some Firebase calls to my /api/index.js file, I received the following error:
The Serverless Function "index" is 50.75mb which exceeds the maximum size limit of 50mb.
I've been troubleshooting for some time and have removed as many third-party packages as possible without success. The size reduction has only been minimal. After researching and applying the suggestion from this comment (using @nuxtjs/[email protected]), the size went down from 80mb to 50.75mb, but the problem still persists.
Does anyone have any advice on how to tackle this? It seems like a common issue, but I'm struggling to find a fix.
api/index.js
constexpress=require('express')constcors=require('cors')constapp=express()const{ collection, getDocs }=require('firebase/firestore')const{ db }=require('../plugins/firebase')app.use(cors())app.use(express.json())app.use(express.urlencoded({extended: true}))app.get('/reviews',async(req,res)=>{try{constreviewsSnapshot=awaitgetDocs(collection(db,'reviews'))constreviews=reviewsSnapshot.docs.map((doc)=>doc.data())res.json(reviews)}catch(error){console.error(error)res.status(500).json({error: error.toString()})}})app.get('/galleries',async(req,res)=>{try{constgalleriesSnapshot=awaitgetDocs(collection(db,'galleries'))constgalleries=galleriesSnapshot.docs.map((doc)=>doc.data())res.json(galleries)}catch(error){console.error(error)res.status(500).json({error: error.toString()})}})app.get('/bookings',async(req,res)=>{try{constbookingsSnapshot=awaitgetDocs(collection(db,'bookings'))constbookings=bookingsSnapshot.docs.map((doc)=>doc.data())res.json(bookings)}catch(error){console.error(error)res.status(500).json({error: error.toString()})}})
Hi,
In my Nuxt 2 application, I'm attempting to use serverless functions with Firebase, but I am encountering an issue with the size limit. After adding some Firebase calls to my /api/index.js file, I received the following error:
I've been troubleshooting for some time and have removed as many third-party packages as possible without success. The size reduction has only been minimal. After researching and applying the suggestion from this comment (using @nuxtjs/[email protected]), the size went down from 80mb to 50.75mb, but the problem still persists.
Does anyone have any advice on how to tackle this? It seems like a common issue, but I'm struggling to find a fix.
api/index.js
store/index.js
store/bookings.js
vercel.json
package.json
The text was updated successfully, but these errors were encountered: