Next.js Discord

Discord Forum

Issue when connecting Nextjs with azure application insights

Unanswered
Japanese Bobtail posted this in #help-forum
Open in Discord
Japanese BobtailOP
So the task is connect my nextjs app with azure application insights. I found the azure sdk https://github.com/Azure/azure-sdk-for-js/blob/%40azure/monitor-opentelemetry-exporter_1.0.0-beta.16/sdk/monitor/monitor-opentelemetry-exporter/samples/v1/typescript/src/httpSample.ts and started to using it in my application. I pasted the app insights setup function in one of the component but after doing it I started to get error
clinical-content:build: ../../node_modules/.pnpm/@azure+monitor-opentelemetry-exporter@1.0.0-beta.17/node_modules/@azure/monitor-opentelemetry-exporter/dist-esm/src/platform/nodejs/persist/fileSystemHelpers.js clinical-content:build: Module not found: Can't resolve 'fs'
Fixied it by adding
"browser": { "fs": false, "path": false, "os": false, "child_process": false, "async_hooks": false }
Now I'm getting the below error when I load the page
Unhandled Runtime Error TypeError: os__WEBPACK_IMPORTED_MODULE_1__.type is not a function
The package which I'm using in the frontend component is using fs. I'm a newbied and stuck here

0 Replies