[rust] println breaks shopify functions

Hello, this is not a critical bug but can cause headaches.

It seems that putting println (not to be confused with eprintln) anywhere in a discount function will silently make it fail with a InvalidOutputError.

This error won’t show up in logs when shopify app dev only in the partner dashboard .

No idea why this happens but is annoying, I’ll see if I can configure my LSP to warn me in the future.

I haven’t tested with other functions yet.

This is how functions work at the moment. They read data into memory through stdin, and the read the result through stdout. If you want to print something, you should print to stderr - note printing/logging in general can cause performance issues.

1 Like