Debugging apps that use the serverless feature can be a little tricky once they are in production. To make this easy, the Freshworks platform enables serverless logging. Now, you can add log messages in the server.js file and then view them in the App Settings page.

1. The maximum supported length of each log is 2000 characters beyond which the log is truncated.
2. At present, viewing serverless logs is possible for custom apps that have at least one installation parameter (iparam).

Adding Logs

You can add logs to the server.js file with one of the following severity levels.

  1. Info: Use this severity level to log general debug or status messages.
  2. Copied Copy
    2"Starting the registration for new user"); object);
  3. Error: Use this severity level to log errors or warnings.
  4. Copied Copy
    console.error("The authentication parameters are invalid"); console.error("Error details", JSON object);
Retrieving Logs

Once the custom app is installed, select the Settings icon and then choose the Serverless Logs tab to view the logs. Logs are displayed in different colors to reflect their severity level. To download them, click the Export button.

For apps that use the OAuth authorization scheme:

  1. In the Apps page, click the reauthorize icon next to the custom app for which you want to view logs. The Reauthorize the App window is displayed.
  2. Click Reauthorize. The app details window is displayed.
  3. Select the Serverless Logs tab, to view all logs.