Troubleshooting your Shopify function in production

Shopify Partner
30 1 12

Here are the steps to troubleshoot your Shopify function in production,


1) Create a mechanism in your function to throw exception/cause panic based on a certain trigger, for example, if the first name is entered as "Debug". This will ensure that this panic is not created in the function randomly when customers enter their details during checkout (Nobody has the first name of debug, right?).


Screenshot 2023-10-25 at 11.17.31 PM.png

This is how to do it in Rust (Place it near the end of the function, preferably),


if first_name == "Debug" {
    panic!("Debug mode activated");



2) Create a mechanism for merchants to follow and generate and share the error logs with you. For example, you can show them a modal with steps to follow, the steps can look something like this,

  - Use the first name of Debug at the checkout to generate the error.

  - Go to the customization in the settings and click on share the error report with the developer.


3) Once the merchant follows your instructions and successfully generates the error and shares with you, you will have all the details of what is going on at their checkout and what output did your function generate in response to the input it received.


Hope this helps.

Reply 1 (1)
Shopify Staff
Shopify Staff
94 25 36

Thanks for this @Sam9516!

For JavaScript/TypeScript developers, you can do the same thing with something like


if (firstName == "Debug") {
  throw "Debug mode activated";


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