The serverless component of the Freshworks apps will print the logs to the serverless logs, unlike the frontend apps print their logs in the browser console.
Steps to view serverless logs
- Go to the Marketplace Apps section and select Manage Apps button.
- Navigate to the Custom Apps tab on top.
- For the required app, click on the Setting button and select “View Log” in the drop-down to go to the serverless logs page of the app.
- Select the time range in the drop-down to get the logs for the selected time range on the serverless logs page.
- Click the reload button to get new logs for the same time range.
Ways to troubleshoot efficiently
- Add custom logs in all the error scenarios in the serverless app functions. Also, add the error message to the logs to find the root cause.
- If the flow has complex conditions and scenarios in a serverless function, add some logs in the positive scenarios to understand which flow the code goes in. It will be helpful when debugging some issues that would have occurred in any of the flows.
- Differentiate the logs that are added during the development and the logs that will go into the production code with console.log() and console.info() statements, respectively. It will help remove all the console.log() statements before publishing the app.
- Remove all the unnecessary logs and big objects those may clutter the logs.
- View the logs efficiently with the exact timestamp or as narrow time as possible. The longer time range while viewing the logs would result in more logs, and sometimes, the logs fetching web requests will take more time and would timeout before returning the results.