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

Error "body.data.baseData.ver cannot be null or undefined." #1310

Closed
jcbit opened this issue Apr 18, 2024 · 12 comments
Closed

Error "body.data.baseData.ver cannot be null or undefined." #1310

jcbit opened this issue Apr 18, 2024 · 12 comments
Assignees

Comments

@jcbit
Copy link

jcbit commented Apr 18, 2024

I just migrated to version 3 and I get this error message:

Envelopes could not be exported and are not retriable. Error message: [
'Error "body.data.baseData.ver cannot be null or undefined." occurred in serializing the payload - "body".'
]
{"stack":"Error: Error "body.data.baseData.ver cannot be null or undefined." occurred in serializing the payload - "body".\n at serializeRequestBody (/home//source//node_modules/@azure/core-client/dist/commonjs/serializationPolicy.js:119:19)\n at Object.sendRequest (/home//source//node_modules/@azure/core-client/dist/commonjs/serializationPolicy.js:28:17)\n at /home//source//node_modules/@azure/core-rest-pipeline/dist/index.js:96:31\n at HttpPipeline.sendRequest (/home//source//node_modules/@azure/core-rest-pipeline/dist/index.js:99:16)\n at ApplicationInsightsClient.sendRequest (/home//source//node_modules/@azure/core-client/dist/commonjs/serviceClient.js:48:30)\n at ApplicationInsightsClient.sendOperationRequest (/home//source//node_modules/@azure/core-client/dist/commonjs/serviceClient.js:110:44)\n at ApplicationInsightsClient.track (/home//source//node_modules/@azure/monitor-opentelemetry-exporter/dist/index.js:1834:21)\n at HttpSender.send (/home//source//node_modules/@azure/monitor-opentelemetry-exporter/dist/index.js:2800:38)\n at HttpSender.exportEnvelopes (/home//source//node_modules/@azure/monitor-opentelemetry-exporter/dist/index.js:2589:55)\n at /home//source//node_modules/@azure/monitor-opentelemetry-exporter/dist/index.js:3864:47\n at AsyncLocalStorage.run (node:async_hooks:338:14)\n at AsyncLocalStorageContextManager.with (/home//source//node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js:33:40)\n at ContextAPI.with (/home//source//node_modules/@opentelemetry/api/build/src/api/context.js:60:46)\n at AzureMonitorLogExporter.export (/home//source//node_modules/@azure/monitor-opentelemetry-exporter/dist/index.js:3863:31)\n at /home//source//node_modules/@opentelemetry/core/build/src/internal/exporter.js:29:28\n at AsyncLocalStorage.run (node:async_hooks:338:14)\n at AsyncLocalStorageContextManager.with (/home//source//node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js:33:40)\n at ContextAPI.with (/home//source//node_modules/@opentelemetry/api/build/src/api/context.js:60:46)\n at /home//source//node_modules/@opentelemetry/core/build/src/internal/exporter.js:28:27\n at new Promise ()\n at Object._export (/home//source//node_modules/@opentelemetry/core/build/src/internal/exporter.js:26:12)\n at doExport (/home//source//node_modules/@azure/monitor-opentelemetry/node_modules/@opentelemetry/sdk-logs/build/src/export/BatchLogRecordProcessorBase.js:124:14)","message":"Error "body.data.baseData.ver cannot be null or undefined." occurred in serializing the payload - "body".","name":"Error"} []

@JacksonWeber
Copy link
Contributor

JacksonWeber commented Apr 18, 2024

@jcbit Can I take a look at your package.json file and your code you use to initialize Application Insights?

Also make sure that you're not calling client.track() in your code, only specific track methods (ex: client.trackDependency()) are supported by Application Insights 3.X SDK.

@prateekkathal
Copy link

Seeing the same issue when using trackException()

Envelopes could not be exported and are not retriable. Error message: [
   'Error "body.data.baseData.ver cannot be null or undefined." occurred in serializing the payload - "body".'
]

My code is a simple:

try {
 // Running code...
} catch (e) {
  appInsights.defaultClient.trackException({ exception: e, severity: appInsights.KnownSeverityLevel.Error });
}

Even if I manually override - exception: new Error('Test'), I still see the same error.

@JacksonWeber
Copy link
Contributor

@prateekkathal @jcbit Thank you for raising this issue. A fix PR has already been merged and will be available in the next release: #1312.

@prateekkathal
Copy link

prateekkathal commented Apr 24, 2024

@JacksonWeber Thank you for the fix. I tested v3.0.1 and it works as expected.

However, I finding these warning logs being emitted as well (also reported in #1316):

@azure/opentelemetry-instrumentation-azure-sdk [
  'Module @azure/core-tracing has been loaded before @azure/opentelemetry-instrumentation-azure-sdk so it might not work, please initialize it before requiring @azure/core-tracing'
]
Accessing resource attributes before async attributes settled []

My code looks like this:

appInsights
  .setup(connectionString)
  .setAutoCollectRequests(false)
  .setAutoCollectPerformance(false, false)
  .setAutoCollectExceptions(false)
  .setAutoCollectDependencies(false)
  .setAutoCollectConsole(false)
  .setUseDiskRetryCaching(false)
  .setSendLiveMetrics(false)
  .start();

this.client = appInsights.defaultClient;
this.client.setAutoPopulateAzureProperties();

Also, if I don't use the set config functions above after setup, I see even more warnings like these:

Invalid metric name: "\ASP.NET Applications(??APP_W3SVC_PROC??)\Request Execution Time". The metric name should be a ASCII string with a length no greater than 255 characters. []
Invalid metric name: "\ASP.NET Applications(??APP_W3SVC_PROC??)\Requests/Sec". The metric name should be a ASCII string with a length no greater than 255 characters. []
Invalid metric name: "\Process(??APP_WIN32_PROC??)\Private Bytes". The metric name should be a ASCII string with a length no greater than 255 characters. []
Invalid metric name: "\Memory\Available Bytes". The metric name should be a ASCII string with a length no greater than 255 characters. []
Invalid metric name: "\Processor(_Total)\% Processor Time". The metric name should be a ASCII string with a length no greater than 255 characters. []
Invalid metric name: "\Process(??APP_WIN32_PROC??)\% Processor Time". The metric name should be a ASCII string with a length no greater than 255 characters. []
Accessing resource attributes before async attributes settled []
Accessing resource attributes before async attributes settled []

Not sure if this requires a fix? Will be great if you can confirm though. Maybe something I am doing wrong?

@JacksonWeber
Copy link
Contributor

JacksonWeber commented Apr 24, 2024

@prateekkathal To address each of these:

  1. Regarding the warning about @azure/core-tracing being logged. The discussion here goes into detail about how you can ignore it if you wish, and it won't impact functionality for you.
  2. The invalid metric names are the performance counters in Application Insights. OpenTelemetry complains about their metric names as they have spaces, but performance counter functionality is not impacted. The reason removing your config caused these warnings is that you had disabled performance counters in your custom config, but they're configured on by default.

Please let me know if you have any other concerns.

@prateekkathal
Copy link

@JacksonWeber Thanks, that makes sense. I wish there was a way to just stop the package from emitting out these logs until a "DEBUG" flag was turned on for example.

These extra logs are not useful for many developers directly using this SDK. Maybe something you can add in the release pipeline?

As far as this issue is concerned though, you can mark it as resolved. Have a good one!

@chriskuech
Copy link

I'm still facing this issue. I've audited my code for .track and only see these methods used:

  • trackEvent
  • trackException
  • trackTrace
  • trackNodeHttpRequest

And I appear to be using the app insights version with the patch (v3.0.1):
image

I have also modified my config to match #1310 (comment).

Yet I'm still getting the errors below... did I miss anything?

Envelopes could not be exported and are not retriable. Error message: [
  'Error "body.data.baseData.ver cannot be null or undefined." occurred in serializing the payload - "body".'
]
{"stack":"Error: Error \"body.data.baseData.ver cannot be null or undefined.\" occurred in serializing the payload - \"body\".\n    at serializeRequestBody (/Users/kuech/Repositories/monorepo/api/node_modules/@azure/core-client/src/serializationPolicy.ts:200:13)\n    at Object.sendRequest (/Users/kuech/Repositories/monorepo/api/node_modules/@azure/core-client/src/serializationPolicy.ts:58:9)\n    at /Users/kuech/Repositories/monorepo/api/node_modules/@azure/core-rest-pipeline/src/pipeline.ts:170:25\n    at HttpPipeline.sendRequest (/Users/kuech/Repositories/monorepo/api/node_modules/@azure/core-rest-pipeline/src/pipeline.ts:176:12)\n    at ApplicationInsightsClient.sendRequest (/Users/kuech/Repositories/monorepo/api/node_modules/@azure/core-client/src/serviceClient.ts:125:26)\n    at ApplicationInsightsClient.sendOperationRequest (/Users/kuech/Repositories/monorepo/api/node_modules/@azure/core-client/src/serviceClient.ts:207:38)\n    at ApplicationInsightsClient.track (/Users/kuech/Repositories/monorepo/api/node_modules/@azure/monitor-opentelemetry-exporter/dist/index.js:1834:21)\n    at HttpSender.send (/Users/kuech/Repositories/monorepo/api/node_modules/@azure/monitor-opentelemetry-exporter/dist/index.js:2800:38)\n    at HttpSender.exportEnvelopes (/Users/kuech/Repositories/monorepo/api/node_modules/@azure/monitor-opentelemetry-exporter/dist/index.js:2589:55)\n    at /Users/kuech/Repositories/monorepo/api/node_modules/@azure/monitor-opentelemetry-exporter/dist/index.js:3864:47\n    at AsyncLocalStorage.run (node:async_hooks:346:14)\n    at AsyncLocalStorageContextManager.with (/Users/kuech/Repositories/monorepo/api/node_modules/@opentelemetry/context-async-hooks/src/AsyncLocalStorageContextManager.ts:40:36)\n    at ContextAPI.with (/Users/kuech/Repositories/monorepo/api/node_modules/@opentelemetry/api/src/api/context.ts:77:42)\n    at AzureMonitorLogExporter.export (/Users/kuech/Repositories/monorepo/api/node_modules/@azure/monitor-opentelemetry-exporter/dist/index.js:3863:31)\n    at /Users/kuech/Repositories/monorepo/api/node_modules/@opentelemetry/core/src/internal/exporter.ts:36:22\n    at AsyncLocalStorage.run (node:async_hooks:346:14)","message":"Error \"body.data.baseData.ver cannot be null or undefined.\" occurred in serializing the payload - \"body\".","name":"Error"} []

@JacksonWeber JacksonWeber reopened this Apr 25, 2024
@JacksonWeber
Copy link
Contributor

@chriskuech Please make sure to use version 3.0.1 of the Application Insights SDK as 3.0.0 has an issue with the manual track methods from incorrect serialization of the log body. Let me know if that version works for you.

@chriskuech
Copy link

@JacksonWeber yes that package.json screenshot is from within my node_modules folder to confirm I'm running v3.0.1.

@JacksonWeber
Copy link
Contributor

@chriskuech Not seeing any similar errors on my end with trackEvent, trackException or trackTrace. However, trackNodeHttpRequest isn't supported in versions 3.0.0 or higher. Can I take a look at one of your example track methods that's throwing that error for you?

@chriskuech
Copy link

Interesting. I restarted the upgrade fresh and removed the trackNodeHttpRequest and no longer have an issue. Sorry for the churn--feel free to close.

@JacksonWeber
Copy link
Contributor

@chriskuech No worries! Always appreciate folks reporting issues, thanks for taking the time to report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants