Randomize Function Crashing Node Server When Array is Empty

Wappler Version : 4.0.1
Operating System : W10
Server Model: NodeJS
Hosting Type: Docker/Digital Ocean

Expected behavior

Using RANDOMIZE function on a multi-query result should randomize the array.

Actual behavior

It crashed the NodeJS server with out-of-memory error.

How to reproduce

I first encountered this about two months ago. At that time, I had randomize working in one SA in the project, but the other SA kept crashing the server. So I just disabled the step that was causing error.

Today, both my staging & production server crashed where this function was working well.
On debugging the issue this time, I found that because the multi-query was not returning any results, randomize function on next step crashed Node server.
Please add handling for empty arrays for all server side formatters.

Unzip file in lib/formatters.

collections.zip (1.1 KB)

1 Like

This has been fixed in Wappler 4.0.2

This topic was automatically closed after 45 hours. New replies are no longer allowed.