Tolsan Tolsan - 10 months ago 96
React JSX Question

Azure Applications Insights node js module not working - Fetch API cannot load error

I am trying to integrate npm's application insights module ( into my React js application.

My source for doing this is:

import appInsights from 'applicationinsights';

The problem I got is that in my Chrome Developer tools I can see a preflight request made to
But in the console I can see the following error:

"Fetch API cannot load
Request header field content-encoding is not allowed by
Access-Control-Allow-Headers in preflight response."

Do you have an idea how can I fix this issue?

Answer Source

The node.js module you are using is the AI SDK for Node.js server. And As the React js applications are client applications in javascript, technically they are different.

Please try to use ApplicationInsights-JS.

Additionally, you can refer to for more info.