StackMemoryLimitExceededError in JavaScript function

I’m developing a function in JavaScript but when deployed I keep seeing a StackMemoryLimitExceededError

The Wasm module exceeded the stack memory limit

This happens even with an unchanged generated function.

This is likely due to a bug in Shopify CLI that’s present in 3.49. You should update to 3.50 or higher, preferably latest.