I'm creating a react-web app that must call a post REST post endpoint on Firebase Cloud functions, the only problem is that the typical request that will go through will exceed the 10mb limit:
/**
* Create a new flyer inside the storage.
* @param {String} adminID [Identifier of the admin issuing the request]
* @param {Object} flyer [Flyer to upload in the storage]
* @returns {Object} [Containing the response]
*/
postFlyerAsync(adminID,flyer){
return new Promise((res,rej)=>{
const URL = endpoint + "postFlyer";
return axios
.post(URL,flyer, { params: { adminID: adminID } })
.then((response) => {
console.log(response)
return res(response.data);
})
.catch((err) => {
return rej(err);
});
})
}
does it exist a way to compress the body? I've tried a million different npm packages but they are either not compatible with webpack config or too slow...any suggestions?
No amount of compression will solve your problem.
You can achieve the same security without opening up your storage by having your endpoint return a signed upload url. https://cloud.google.com/storage/docs/access-control/signed-urls