Skip to content

[BUG] Consuming trackEvent from useAppInsights results in DynamicProto error #121

@DZetko

Description

@DZetko

Description/Screenshot
I have below React component

`
import React from "react";
import { useAppInsightsContext } from "@microsoft/applicationinsights-react-js";
const TestComponent = () => {
const { trackEvent } = useAppInsightsContext();

function onClick() {
    trackEvent({ name: "TestComponent test" });
}

return (
    <div className="App">
        <div>
            <button onClick={onClick}>Add Number</button>
        </div>
    </div>
);

};
export default TestComponent;
`

When I click the Add Number button, I am getting bellow error message:
Image

My Application Insights instance is set up as below

Image

Steps to Reproduce

  • OS/Browser: MacOS Sonoma 14.6.1, Chrome 129.0.6668.100 (arm64)
  • React Version: 17.0.2, same happens with 18.3.1
  • SDK Version [e.g. 22]: 17.3.3
  • How you initialized the SDK:

Expected behavior
Error should not be displayed and event should be sent to Application Insights.

Additional context
Add any other context about the problem here.

When using reactPlugin instance directly and calling reactPlugin.trackEvent works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions