Monitor and debug scripts

Monitor your scripts and investigate errors from the app's Checkout extensions section in your Partner Dashboard.

Currently, it can take up to two minutes for run results to display in your Partner Dashboard.

Error types

Currently, all script errors are labelled as RunErrors in the Partner Dashboard. The following lists the types of errors that you can have:

  • Execution timeouts - These errors occur when your script takes too long to run. An example of an execution timeout error is an error that could cause a script to run indefinitely, such as an infinite loop:

  • Runtime errors - These errors are general errors that can't be identified at compile time. This includes the following errors:

    • stack overflow
    • integer divide by zero
    • unreachable, including any thrown errors that you added to your code

Debugging

Add message logs to your scripts to help debug them when errors occur.

You can use Console.log and as-pect’s log function to log messages from your script and tests. Before you use either, review the following considerations:

  • In AssemblyScript, Console.log accepts only strings as its argument.
  • as-pect’s log function is easier to use because it accepts multiple data types and its output is better formatted. You can use log in unit tests and in scripts as long as you remove them from the scripts before you push them.

Avoid breaking changes

When you push a new script, it replaces the current live script on the app. If the new script's configuration schema is not backward compatible, then make sure that the configuration values are also updated.

Common runtime errors related to configurations involve the following issues:

  • Missing configuration values
  • Type casting errors
  • Renaming configuration keys

You can minimize a script's downtime by contacting the store and working with their staff to delete and recreate their customizations. You can also include checks in your script to better handle errors. For example, if a configuration value doesn't exist, then your script could use a default value instead.

Deleting scripts and apps

Delete your scripts from apps by using the Partner Dashboard. Before you delete a script, make sure that it's turned off in all stores.

Don't delete any app that you add scripts to.