Debug your Community Connector

  • Community Connectors can be debugged by enabling extended error messages or logging execution data.

  • isAdminUser() function controls debug message visibility, returning true for users who should see them and false otherwise.

  • Leverage Apps Script's logging mechanisms, such as the built-in Logger, Stackdriver, or even a Google Sheet, to proactively identify and resolve bugs while protecting user data privacy.

  • Designing isAdminUser() to always return true for developers and using getEffectiveUser() with a safelist can aid in debugging and reproducing user errors.

You can debug your Community Connector in two ways:

  1. Enabling extended error messages
  2. Logging relevant execution data

This guide outlines how to make effective use of these capabilities.

Enabling/disabling debug features

isAdminUser() should return true if the current user should see debug messages and stack traces. If isAdminUser() returns false, or is not defined, and an error occurs, the user will see a generic error message.

Debugging Tips

  • Design isAdminUser() so it always returns true for developers.
  • Use getEffectiveUser() in combination with an email safelist of trusted users to easily add or remove users that should see the full error details. This can be especially useful if a user runs into an error that you have trouble reproducing.
  • Make liberal use of newDebugError() for invariants that should hold true. This can help with narrowing down problems in the future.

Apps Script logging

Apps Script provides different mechanisms for logging including the built-in Apps Script Logger, Stackdriver Logging, and Stackdriver Error Reporting. You can also try logging to a Google Sheet. Proactive logging can help to quickly narrow in on the cause of bugs, though care should be taken to not log sensitive user data.