diff --git a/README.md b/README.md index b87cb00..d77c2ff 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # Getting Started with Create React App -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). +This is a repro for [github issue 2336 in *microsoft/ApplicationInsights-JS* repo](https://github.com/microsoft/ApplicationInsights-JS/issues/2336). + +Just run `npm run build` to get the build error on `ignoreHeaders`. + ## Available Scripts diff --git a/src/App.tsx b/src/App.tsx index a53698a..bbf3ff8 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,8 +1,20 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import logo from './logo.svg'; import './App.css'; +import {appInsights} from './telemetry'; +import { useAppInsightsContext } from '@microsoft/applicationinsights-react-js'; function App() { + // const appInsights = useAppInsightsContext(); + + useEffect(() => { + if (appInsights) { + console.log("AppLoaded"); + appInsights.trackEvent({ name: "AppLoaded" }); + alert("AppLoaded"); + } + }, [appInsights]); + return (
diff --git a/src/telemetry.ts b/src/telemetry.ts index e3583e9..28a37be 100644 --- a/src/telemetry.ts +++ b/src/telemetry.ts @@ -15,6 +15,8 @@ const appInsights = new ApplicationInsights({ disableFetchTracking: false, //enableRequestHeaderTracking: true, // Enable to get request headers in dependency logs enableResponseHeaderTracking: true, // Enable to get response headers in dependency logs + // BUG: FOLLOWING LINE GIVES ERROR ON BUILD + // Object literal may only specify known properties, and 'ignoreHeaders' does not exist in type 'IConfiguration & IConfig'.ts(2353) ignoreHeaders: [ "Authorization", "X-API-Key",