Skip to content

Commit

Permalink
Link to bug and more complete repro
Browse files Browse the repository at this point in the history
* Added link to the [bug][1] into Readme
* Added more complete instrumentation, by instrumenting App with an event
  - Would have been unnecessary though I think as default instrumentation seems to already send data
* Commented telemetry.ts on what is the bug (error description)

[1]: microsoft/ApplicationInsights-JS#2336
  • Loading branch information
avi-vw committed Apr 26, 2024
1 parent 031ab8d commit 467aa18
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
5 changes: 4 additions & 1 deletion 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

Expand Down
14 changes: 13 additions & 1 deletion 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 (
<div className="App">
<header className="App-header">
Expand Down
2 changes: 2 additions & 0 deletions src/telemetry.ts
Expand Up @@ -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",
Expand Down

0 comments on commit 467aa18

Please sign in to comment.