Skip to content

[BUG] Failed to monitor Window.fetch #2664

@TheMatrixan

Description

@TheMatrixan

Description/Screenshot

I have a Next.js app (v15 app router) with AI integrated but in the AI there're a lot of errors like this one:

AI (Internal): 15 message:"
Failed to monitor Window.fetch, monitoring data for this ajax call may be incorrect.
props: {
  ajaxDiagnosticsMessage:,
  exception:[object Error]: {
    stack: "TypeError: n[o.Sj] is not a function
     at H (https://example.com/_next/static/chunks/465-cd84ab02758a5705.js:1:34667)
     at https://example.com/_next/static/chunks/5339-7f30b31bf9ed8cea.js:1:117023
     at req (https://example.com/_next/static/chunks/5339-7f30b31bf9ed8cea.js:1:117255)
     at https://example.com/_next/static/chunks/5339-7f30b31bf9ed8cea.js:1:34067
     at t1 (https://example.com/_next/static/chunks/5339-7f30b31bf9ed8cea.js:1:33916)
     at t2 (https://example.com/_next/static/chunks/5339-7f30b31bf9ed8cea.js:1:33967)
     at https://example.com/_next/static/chunks/5339-7f30b31bf9ed8cea.js:1:34560
     at y (https://example.com/_next/static/chunks/7934-69bcf3dc80c2431b.js:1:47919)
     at _ (https://example.com/_next/static/chunks/7934-69bcf3dc80c2431b.js:1:46789)
     at https://example.com/_next/static/chunks/7934-69bcf3dc80c2431b.js:1:10999",
     message: "n[o.Sj] is not a function",
     name: "TypeError"
  }
}

Steps to Reproduce

Just open the page with such configuration.

  • OS/Browser:

  • SDK Version [e.g. 22]:

"@microsoft/applicationinsights-react-js": "^19.3.8",
"@microsoft/applicationinsights-web": "^3.3.10",
  • How you initialized the SDK:
const APP_INSIGHTS_REACT_PLUGIN = new ReactPlugin()

const browserHistory = createBrowserHistory({})

appInsights = new ApplicationInsights({
  config: {
    connectionString: process.env.APPLICATIONINSIGHTS_CONNECTION_STRING,
    enableAutoRouteTracking: true,
    enableRequestHeaderTracking: true,
    enableResponseHeaderTracking: true,
    enableAjaxPerfTracking: true,
    enableAjaxErrorStatusText: true,
    maxAjaxCallsPerView: 10,
    disableExceptionTracking: false,
    extensions: [APP_INSIGHTS_REACT_PLUGIN],
    enableDebug: process.env.APPLICATIONINSIGHTS_DEBUG === 'true',
    extensionConfig: {
      [APP_INSIGHTS_REACT_PLUGIN.identifier]: { history: blockDynamicConversion(browserHistory) },
    },
  },
})

appInsights.loadAppInsights()
setAppInsights(appInsights)

Expected behavior

No errors in the Azure AI.

Additional context

It's probably the fieldRedaction function:

// EnvUtils.js
function fieldRedaction(input, config) {
    if (!input || input[_DYN_INDEX_OF ](" ") !== -1) {
        return input;
    }
    ...
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions