Discussing Shopify Functions development, deployment, and usage in Shopify apps.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Is there a way to manually throw an error in order to get access to debugging logs? I'm testing functions on a dev store with preview enabled, but the functions do not seem to be working after deploy and I can't figure out how to trigger an error report as described in the docs. I attempted to just immediately return an error with a custom error message from the main function but that doesn't seem to have done anything either. Any help here?
Hi @tontinedev --
Your best option in Rust for manually triggering an error is to use panic!. Then you can take an action which triggers your function (such as adding a product to cart or changing the quantity in the cart), which will then trigger an error report as described in the docs. The error report will show your function input and any other debug output you've printed to STDERR.
We are working on simpler ways of exposing debugging information to you, but this is your best approach in the mean time.
-Nick
Nick Wesselman | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog