POST input array limit

I’m posting an array of inputs and it is failing consistently on the 22 item…every time, regardless of the content.

This is the relevant loop. It loops through the $_POST.text_step array, and inserts the value:

The error that triggers on the 22nd insert is:

code: "ER_BAD_FIELD_ERROR"
message: "insert into `recipe_steps` (`recipe_id`, `step_order`, `step_text`, `tenant_id`) values (9011, 22, {\"21\":\"Fudgy Sweet Potato Brownie\"}, 61) - ER_BAD_FIELD_ERROR: Unknown column '21' in 'field list'"
stack: "Error: ER_BAD_FIELD_ERROR: Unknown column '21' in 'field list'\n    at Query.Sequence._packetToError (/home/dev-01/domains/mpp.dev.uniqueideas.com/nodeapp/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)\n    at Query.ErrorPacket (/home/dev-01/domains/mpp.dev.uniqueideas.com/nodeapp/node_modules/mysql/lib/protocol/sequences/Query.js:79:18)\n    at Protocol._parsePacket (/home/dev-01/domains/mpp.dev.uniqueideas.com/nodeapp/node_modules/mysql/lib/protocol/Protocol.js:291:23)\n    at Parser._parsePacket (/home/dev-01/domains/mpp.dev.uniqueideas.com/nodeapp/node_modules/mysql/lib/protocol/Parser.js:433:10)\n    at Parser.write (/home/dev-01/domains/mpp.dev.uniqueideas.com/nodeapp/node_modules/mysql/lib/protocol/Parser.js:43:10)\n    at Protocol.write (/home/dev-01/domains/mpp.dev.uniqueideas.com/nodeapp/node_modules/mysql/lib/protocol/Protocol.js:38:16)\n    at Socket.<anonymous> (/home/dev-01/domains/mpp.dev.uniqueideas.com/nodeapp/node_modules/mysql/lib/Connection.js:88:28)\n    at Socket.<anonymous> (/home/dev-01/domains/mpp.dev.uniqueideas.com/nodeapp/node_modules/mysql/lib/Connection.js:526:10)\n    at Socket.emit (events.js:314:20)\n    at addChunk (_stream_readable.js:297:12)\n    --------------------\n    at Protocol._enqueue (/home/dev-01/domains/mpp.dev.uniqueideas.com/nodeapp/node_modules/mysql/lib/protocol/Protocol.js:144:48)\n    at Connection.query (/home/dev-01/domains/mpp.dev.uniqueideas.com/nodeapp/node_modules/mysql/lib/Connection.js:198:25)\n    at /home/dev-01/domains/mpp.dev.uniqueideas.com/nodeapp/node_modules/knex/lib/dialects/mysql/index.js:134:18\n    at new Promise (<anonymous>)\n    at Client_MySQL._query (/home/dev-01/domains/mpp.dev.uniqueideas.com/nodeapp/node_modules/knex/lib/dialects/mysql/index.js:128:12)\n    at Client_MySQL.query (/home/dev-01/domains/mpp.dev.uniqueideas.com/nodeapp/node_modules/knex/lib/client.js:168:17)\n    at Runner.query (/home/dev-01/domains/mpp.dev.uniqueideas.com/nodeapp/node_modules/knex/lib/runner.js:151:36)\n    at /home/dev-01/domains/mpp.dev.uniqueideas.com/nodeapp/node_modules/knex/lib/runner.js:40:23\n    at /home/dev-01/domains/mpp.dev.uniqueideas.com/nodeapp/node_modules/knex/lib/runner.js:277:24\n    at runMicrotasks (<anonymous>)"
status: "500"

You can see it is attempting to insert an object on this record instead of a string.

This post suggests I’m not the first to see this in node:

Or maybe a post size limit (although it doesn’t look like it)?

Screen Shot 2021-07-15 at 4.10.15 PM

@patrick @George ???

The problem is the qs module as mentioned at stackoverflow. There is an options arrayLimit, but the problem is that the qs module is mostly used inside other modules and they don’t allow to set the option.

Will see if there is some workaround or perhaps we have to replace the current module we use.

You can test following update, unzip in lib/setup.

upload.zip (781 Bytes)

Nice, thanks Patrick. Quick test shows it is working fine now.

It’s too bad there needs to be a limit (now 100) but I understand why.

Solved now in Wappler 4 beta 13