Why the Product Discount Function built doesn't work on the live app as same on the demo/test mode?

Our team built the function of creating a Product Discount Function accordingly to the guidance provided by the Shopify public doc.
However, error is being encountered as it doesn’t work on the live app as the test app mode.

It works on the demo app version when implementing the Product Discount Function Screenshot by Lightshot
But it doesn’t on the live app version Screenshot by Lightshot

It’s difficult for us, we indeed have no idea about the reason why it only doesn’t work on the live app version while everything is normal in the test mode.

Your feedback/advice is highly appreciated!
Thank you so much for your review

A StackMemoryLimitExceededError usually indicates an infinite loop of some kind.

What version of Shopify CLI are you using? There was a bug with JavaScript functions on a particular version of Shopify CLI that caused this. But it’s an old version at this point.

Have you tried using shopify app function run with the input from the failed execution to see if you can replicate the issue locally? Or use the input from that execution to create a unit test?

2 Likes

We wholeheartedly appreciate your feedback and suggestions. Thank you so much!!
Our team already updated the latest version of Shopify CLI to 3.69. Also, in the run.js file in the discount function, we comment all the code and just console.log(‘test’); but when running it still reports the error StackMemoryLimitExceededError
We are stuck in this step to move the function to the live app version
Any advice is welcome and highly appreciated!!
Thank you so much in advance

Our team already updated the latest version of Shopify CLI to 3.69.

Are you using Shopify CLI as a project dependency or a global install? You should ensure you have updated the right one.

but when running it still reports the error StackMemoryLimitExceededError

When running it on Shopify, or locally with shopify app function run?

Can you replicate the issue with a brand new function? If so can you attach or link the dist/function.js and /dist/function.wasm?