Skip to content

Commit 01227a5

Browse files
Merge pull request #223941 from diberry/diberry/0113-swa-hybrid-app-insights
SWA + Next Hybrid + Application Insights
2 parents 129fb73 + 9f5e612 commit 01227a5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

articles/static-web-apps/deploy-nextjs-hybrid.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,15 @@ Begin by adding an API route.
207207
208208
:::image type="content" source="media/deploy-nextjs/nextjs-api-route-display.png" alt-text="Display the output from the API route":::
209209
210+
## Enable logging for Next.js
211+
212+
Following best practices for Next.js server API troubleshooting, add logging to the API to catch these errors. Logging on Azure uses **Application Insights**. In order to preload this SDK, you need to create a custom start up script. To learn more:
213+
214+
* [Example preload script for Application Insights + Next.js](https://medium.com/microsoftazure/enabling-the-node-js-application-insights-sdk-in-next-js-746762d92507)
215+
* [GitHub issue](https://github.com/microsoft/ApplicationInsights-node.js/issues/808)
216+
* [Preloading with Next.js](https://jake.tl/notes/2021-04-04-nextjs-preload-hack)
217+
218+
210219
## Clean up resources
211220
212221
If you're not going to continue to use this application, you can delete the Azure Static Web Apps instance through the following steps:

0 commit comments

Comments
 (0)