Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

249
Vistas
How to compress json response size in Firebase cloud functions?

i have a firebase callable function that takes data from a sql cloud database (mysql).

this is the code:

// Get records
exports.getRecords = functions.region("europe-west1").https.onCall((data, context) => {
  // get data
  const table_name = data.table_name

  return mysqlPromise.createPool(db.connectionOptions)
    .then(pool => {    
      return pool.query(`
        SELECT * FROM ${table_name};`
      )
    })
    .then(res => {
      return { result: res };
    })
    .catch(error => {
      throw new functions.https.HttpsError('failed-precondition', error);
    });
});

If I run the function on a table with few rows (up to 10000) it works perfectly, but if the table is bigger (100K records) the execution fails showing a "CORS error".

Analyzing the response, I noticed that the response size on a query that requires 100K rows is around 25MB.

I know that the limit quota of the firebase functions is 10MB for each response, and I am pretty sure that the error is due to that (even if CORS sounds strange).

The question is:

"Is there any way to run that query that returns a 100k rows json to me?"

maybe I have to compress the response or else ... what is the best solution?

Thanks in advance! :)

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda