File Upload Limitation on Google Cloud Run

394 views Asked by At

We deployed a node application on cloud run and it is working fine. Now we have got a new requirement of uploading files of size Up to 5GB and for some business reasons we won’t be able to use cloud storage. After some initial research we found that cloud run has limit of 32MB and this limit is only for HTTP1 requests but not HTTP2 requests. You can find that in below URL.

https://cloud.google.com/run/quotas#cloud_run_limits

So we upgraded our application to support HTTP2 and deployed it. below is the sample code.

const spdy = require('spdy');
const fs = require('fs');
const adminRouter = require("./routes/admin.router")

const PORT = 8080;
const CERT_DIR = `${__dirname}/cert`;
const useSSL = !!process.env.SSL;

const app = express();

app.use("/api", adminRouter)

function createServer() {
    if (!useSSL) {
        return app;
    }
    return spdy.createServer(
        {
            key: fs.readFileSync(`${CERT_DIR}/server.key`),
            cert: fs.readFileSync(`${CERT_DIR}/server.cert`),
            allowHTTP1: true
        },
        app
    );
}

const server = createServer();

server.listen(PORT, () => {
    console.log(`App listening on port ${PORT}`);
    console.log(`SSL ${useSSL ? 'enabled' : 'disabled'}`);
});

We also enabled “Use HTTP/2 end-to-end” checkbox in cloud run service NETWORK Tab. The moment we enabled this option we are getting this error “upstream connect error or disconnect/reset before headers. reset reason: protocol error”.

Can somebody throw some light on below questions,

  1. Why do we get this error ? how do we resolve this ?
  2. Is Cloud run a feasible service for our requirement of uploading huge files ?
  3. If not what could be the alternate solution here? (remember we can’t use google cloud storage for business reasons) ?

Thanks in Advance

0

There are 0 answers