Configuring Request Limits in a Meteor.js Application

I'm encountering an issue while trying to send a large amount of JSON data to a server-side route in my Meteor.js application. The error message I keep receiving is:

Error: Request Entity Too Large at Object.exports.error (/mnt/data/2/node_modules/connect/lib/utils.js:62:13) at limit (/mnt/data/2/node_modules/connect/lib/middleware/limit.js:46:47) at urlencoded (/mnt/data/2/node_modules/connect/lib/middleware/urlencoded.js:58:5) at /mnt/data/2/node_modules/connect/lib/middleware/bodyParser.js:55:7 at json (/mnt/data/2/node_modules/connect/lib/middleware/json.js:46:55) at Object.bodyParser [as handle] (/mnt/data/2/node_modules/connect/lib/middleware/bodyParser.js:53:5) at next (/mnt/data/2/node_modules/connect/lib/proto.js:190:15) at Object.query [as handle] (/mnt/data/2/node_modules/connect/lib/middleware/query.js:44:5) at next (/mnt/data/2/node_modules/connect/lib/proto.js:190:15) at Object.Package [as handle] (packages/spiderable/spiderable.js:108)

After some research, it seems that I need to adjust the request limit for the connect middleware. Can anyone provide guidance on how to do this in Meteor? Thanks!

Answer №1

To address this issue, one potential solution involves inserting the provided code snippet onto the server side, within the Meteor.startup function:

Router.configureRequestBodyParsers = function() {
  Router.onBeforeAction(Iron.Router.bodyParser.urlencoded({
    extended: true,
    limit: '100mb'
  }));
};

(source)

Answer №2

After some trial and error, I found a solution that worked for me by making modifications to the IronRouter package. In the /lib/server/router.js file, on line 30, I made the following change...

start: function () {
connectHandlers
  .use(connect.query())
  .use(connect.bodyParser())
  .use(_.bind(this.onRequest, this)); },

Changed to...

start: function () {
connectHandlers
  .use(connect.query())
  .use(connect.bodyParser({limit: '100mb'})) // or adjust as needed
  .use(_.bind(this.onRequest, this)); },

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Click event not functioning correctly in Internet Explorer

When using jQuery, I have the following code: <script type="text/javascript"> $(document).ready(function(){ $('body').on('click', '.add-photo',function() { $("#images").append($('<input/>').attr(&apo ...

Achieve rapid Key-Value Coding with empty values using NSDictionary

Unsure if the question has been named correctly but here is the scenario: Imagine a JSON response returned from an API, which is then parsed using SBJson with great success. An example of the JSON structure includes: { "value": 15199, //this ...

The directive attribute in AngularJS fails to connect to the directive scope

I have been attempting to pass an argument to a directive through element attributes as shown in the snippet below: directive app.directive('bgFluct', function(){ var _ = {}; _.scope = { data: "@ngData" } _.link = function(scope, el ...

How to set a background image with vue.js

My website design requires 70% of the page to be covered with an image, but the image is currently blank. I am using Vue.js as my frontend framework. Below is the code snippet that is resulting in a blank space: <script setup lang="ts"> imp ...

Executing form validation upon submission of a form from the view in BackboneJS

Recently, I delved into using Backbone.js to organize my JavaScript code and create modular applications. However, I encountered a snag when dealing with events. My goal is to develop a simple View that can handle forms and validate them. Eventually, I pl ...

Distinguishing Between Angular and Ajax When Making Requests to a NodeJS Server

Trying to establish communication between an Angular client and a NodeJS server. Previous method using JQuery $.ajax({ url: "/list", type: "POST", contentType: "application/json", dataType: "json", success: function(data) { console.log("Data ...

Collaborative Artistry: Using HTML5, JavaScript, and Node.js for Multiplayer

Creating a multiplayer drawing application for touch-enabled devices has been a challenge. I have utilized Node.js with Socket.io to draw points on a canvas, but there's an issue with the touchend event not resetting properly. To illustrate, take a l ...

Having trouble getting Material-UI classes to work with external SVG icons?

I recently crafted a Material-UI persistent drawer that contains a list item component designed to alter the icon color upon user interaction. However, my styling adjustments only seem to apply to Material-UI icons and not external SVG ones. If you'r ...

The CSS styling for a pie chart does not seem to be functioning properly when using jQuery's

https://i.stack.imgur.com/kEAKC.png https://i.stack.imgur.com/03tHg.png After examining the two images above, it appears that the CSS is not functioning properly when I try to append the same HTML code using JavaScript. Below is the snippet of my HTML co ...

Interactive tables created using Google Visualization

I have a Google visualization data table that works well, but I am facing an issue with the width of the table. When I click as shown in the image, I call the function drawTable(); and then I encounter this: As you can see, the table does not have a width ...

What is the best way to incorporate a Json file into a JavaScript file?

Using JSON data in JavaScript I recently wrote a JavaScript program that selects a random "advice number" between 1 and 50. Now, I need to figure out how to access a JSON file for the advice messages. JavaScript file: Advice_number = Math.floor(Math.ran ...

Sorting feature fails to function properly when used in combination with pagination and

<table> <thead> <tr> <th class="col-md-3" ng-click="sortDirection = !sortDirection">Creation Date</th> </tr> </thead> <tbody> <tr dir-paginate="item in items | filter:itemFilter | items ...

A guide on updating data dynamically in Vue.js

I am facing an issue with Vue JS in my frontend development. Here is the data for my component - data: () => ({ email: "", showError : false }), Below is the corresponding HTML code - <div v-show='showError' c ...

Can somebody assist me in deciphering and grasping the concepts of smali?

Currently, I am delving into experimenting with my Android device in order to gain a better understanding of application code. However, I find myself struggling when it comes to editing the smali code. This task isn't as straightforward for someone li ...

Learning how to interpret and implement this particular syntax within JavaScript Redux Middleware can be a valuable skill

Currently, I am diving into the world of redux middleware by referring to this informative article: http://redux.js.org/docs/advanced/Middleware.html The code snippet presented below serves as an illustration of how a logging middleware works. const log ...

What is the best way to incorporate multiple functions within a React button?

I need to implement a functionality where the startClick function is triggered on BackButton click before executing the dispatch (giveForm2PreviousStep(props.currentStep, props.goToStep)) method. How can this be achieved? Inquiry JS const Inquiry = props ...

Combining arrays of objects in VueJS

I am working with 2 components: parent component (using vue-bootstrap modal with a vue-bootstrap table) child component (utilizing vue-bootstrap modal with a form) Issue: When I submit the form in the child component, it successfully adds the object to ...

A guide on how to Serialize LocalDate with Gson

I am working with a POJO that looks like this: public class Round { private ObjectId _id; @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy") @JsonDeserialize(using = LocalDateDeserializer.class) @JsonSerialize(using = L ...

Calculate the number of elements in a given array within a specific document

I'm in the process of setting up a blog where each post consists of multiple paragraphs. My goal is to be able to count the number of paragraphs in a specific post. The structure of my "Blog" collection, which contains documents (posts), looks like th ...

Meteor - Failure to establish connection. No sign of life detected

I encountered the following issue: Connection timeout. No heartbeat received. After transferring my meteor app to a new computer with the same code base, I am facing this error when trying to access it (http://127.0.0.1:3000). The server is working fin ...