Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request entity too large error #1599

Open
KillianRousseau opened this issue Jul 4, 2018 · 0 comments
Open

Request entity too large error #1599

KillianRousseau opened this issue Jul 4, 2018 · 0 comments

Comments

@KillianRousseau
Copy link

KillianRousseau commented Jul 4, 2018

Hi,

I'm trying to send data from a node js server to a meteor app. In the node js I'm doing this :
axios.put('http://localhost:3000/api/project/'+id,{"data" :data, "idExtractor":idExtractor, "version":getVersion()})
where data is a string of the XML given by our server

And in my meteor app I'm receiving this in a server route, but when the data is too large, the meteor server give me the errors "socket hang up" and "request entity too large".

I tried solutions from 710 and other issues, doing the following code in the lib/Router.js file. I tried to put it before all routes definitions, before REST routes, after all routes, I also tried to put it in server/main.js in the startup block

if (Meteor.isServer) {
Router.onBeforeAction( Iron.Router.bodyParser.raw({type: '/', only: ['creditReferral'], verify: function(req, res, body){ req.rawBody = body.toString(); }, where: 'server'}));
Router.onBeforeAction(Iron.Router.bodyParser.urlencoded({
extended: true,
limit : '10mb'
}));
Router.onBeforeAction( Iron.Router.bodyParser.urlencoded({ extended: true, limit : '10mb' }), {where: 'server'});
}

I also tried to change these limits in the node server with this

express.urlencoded({limit: '10mb', extended: true, type: "application/x-www-form-urlencoded"})
express.json({limit: '10mb', strict: false, type: "application/json"})
app.use(bodyParser.json({limit: '10mb'}));
app.use(bodyParser.urlencoded({ extended: true, limit :'10mb' }));

But I always have the same problem, all help would be greatly appreciated.

Edit :

Solved this problem, here is how I fixed it https://stackoverflow.com/questions/51193351/meteor-iron-router-error-request-entity-too-large/51381478#51381478

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant