Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Getting Error AI (Internal): 24 message:"Missing required field specification. The field is required but not present on source" props:"{field:id,name:baseData}" #2469

Open
kishor-dabi opened this issue Jan 27, 2025 · 6 comments
Assignees
Labels
investigation required Further investigation or discussions required

Comments

@kishor-dabi
Copy link

Description/Screenshot
On logging custom messages on Application Insights, I am getting below error

AI (Internal): 24 message:"Missing required field specification. The field is required but not present on source" props:"{field:id,name:baseData}"

Image

Steps to Reproduce

  • How you initialized the SDK: Application Insights JavaScript (Web) SDK

Expected behavior

it should not log this error on Application Insights.

@MSNev
Copy link
Collaborator

MSNev commented Jan 28, 2025

How are you using the SDK, the baseData is a required field by the back end, if we didn't log the error here it would cause the telemetry to fail to send...

Here is the only location where we report this critical error

_throwInternal(logger,
eLoggingSeverity.CRITICAL,
_eInternalMessageId.MissingRequiredFieldSpecification,
"Missing required field specification. The field is required but not present on source",
{ field, name });

Can you provide a JSON dump of the telemetry you are trying to report so that we can check if this is a special case that we need to handle?

@kishor-dabi
Copy link
Author

kishor-dabi commented Jan 28, 2025

We are using the Snippet Setup to initialise the it which is mentioned in link

https://github.com/Microsoft/ApplicationInsights-JS?tab=readme-ov-file#snippet-setup-ignore-if-using-npm-setup

we are calling below function to add telemetry and we are able to see this in Application insights with error.

appInsights.trackPageView({ name: "Landing page" })

Also we are using click analytics plugin in our application

below request is seen in the network tab from the javascript SDK.

{ "time": "2025-01-28T05:22:48.959Z", "iKey": "****-1cea-****-bfe2-cfdb689937f6", "name": "Microsoft.ApplicationInsights.666216d21cea473fbfe2cfdb689937f6.Message", "tags": { "ai.user.id": "***************", "ai.session.id": "***********", "ai.device.id": "browser", "ai.device.type": "Browser", "ai.operation.name": "/", "ai.operation.id": "***************", "ai.internal.sdkVersion": "javascript:3.3.4_ClickPlugin2.6.2", "ai.internal.snippet": "8", "ai.internal.sdkSrc": "https://js.monitor.azure.com/scripts/b/ai.3.gbl.min.js" }, "data": { "baseType": "MessageData", "baseData": { "ver": 2, "message": "AI (Internal): 24 message:\"Missing required field specification. The field is required but not present on source\" props:\"{field:id,name:baseData}\"", "properties": {} } } }

@MSNev MSNev added the investigation required Further investigation or discussions required label Jan 29, 2025
@MSNev MSNev added this to the 3.3.5 milestone Jan 29, 2025
@Karlie-777
Copy link
Contributor

@kishor-dabi do you mind sharing your config and when do you call the trackPageview? Based on the code, baseData.id is required for pageview events, and it is set when we create data envelop

// special case: pageview.id is grabbed from current operation id. Analytics plugin is decoupled from properties plugin, so this is done here instead. This can be made a default telemetry intializer instead if needed to be decoupled from channel
let currentContextId;
if (((telemetryItem.ext || {}).trace || {}).traceID) {
currentContextId = telemetryItem.ext.trace.traceID;
}
const id = bd.id || currentContextId;

so if none id can be retrieved from the original telemetry item, it will be default to trace id. So I assume your pageview might be called before the sdk is fully initialized.

@kishor-dabi
Copy link
Author

kishor-dabi commented Jan 30, 2025

@Karlie-777 please find below configuration object

{
    connectionString: window.connectionString,
        enableAutoRouteTracking: true,
            extensions: [
                {
                    autoCapture: true,
                    dataTags: {
                        useDefaultContentNameOrId: true
                    }
                }
            ],
                extensionConfig: {
        [clickPluginInstance.identifier] : {
            autoCapture: true,
                dataTags: {
                useDefaultContentNameOrId: true
            }
        },
        dataTags: {
            useDefaultContentNameOrId: true
        }
    },
}

@Karlie-777
Copy link
Contributor

@kishor-dabi I am curious why the {...autocaputure : true} is at the extensions sections? and dataTags config is duplicated inside extensionConfig? (i assume it might the formatting issue)

@Karlie-777
Copy link
Contributor

one example of config:

     {
                    connectionString: ...,
                    ...
                    extensions: [clickAnalyticsInstance],
                    extensionConfig: {
                        [clickAnalyticsInstance.identifier]: {
                            dataTags: {
                                useDefaultContentNameOrId : ...
                                ....
                            }
                        }
                    }
                }

@MSNev MSNev removed this from the 3.3.5 milestone Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigation required Further investigation or discussions required
Projects
None yet
Development

No branches or pull requests

3 participants