Azure / Azure/static-web-apps

Preloading Application Insights for SSR Next.js

Open
#1,269 4 comments 4 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

I'm having a hard time initializing Application Insights for server-side of Next.js deployed in `standalone` mode. that is being deployed using `AzureStaticWebApp` task from a DevOps pipeline.

Following this guide does not help to achieve that: https://learn.microsoft.com/en-us/azure/static-web-apps/deploy-nextjs-hybrid#enable-logging-for-nextjs
I tried with a custom startup script as described in the tutorial [Example preload script for Application Insights + Next.js](https://medium.com/microsoftazure/enabling-the-node-js-application-insights-sdk-in-next-js-746762d92507) but learned that it does not get executed.

I also tried instrumentation hooks introduced recently in Next.js but they do not get called too.

Being desperate, I modified the build script to inject custom code into the generated .`next/standalone/server.js` but it seems this is not used.

Does anyone know how to load `applicationinsights` nodejs lib?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.