AI-generated Key Takeaways
-
Community Connectors can be debugged by enabling extended error messages or logging execution data.
-
isAdminUser()
function controls debug message visibility, returningtrue
for users who should see them andfalse
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 returntrue
for developers and usinggetEffectiveUser()
with a safelist can aid in debugging and reproducing user errors.
You can debug your Community Connector in two ways:
- Enabling extended error messages
- 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 returnstrue
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.