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

Field 'assembly' on type 'StackFrame' is too long. Expected: 1024 characters [BUG] #1990

Closed
zach-thrivetribe opened this issue Feb 10, 2023 · 3 comments

Comments

@zach-thrivetribe
Copy link

Description/Screenshot

I am attempting to log an exception in response I get a 400 response with the following:

{
	"itemsReceived": 1,
	"itemsAccepted": 0,
	"errors": [
		{
			"index": 0,
			"statusCode": 400,
			"message": "100: Field 'assembly' on type 'StackFrame' is too long. Expected: 1024 characters"
		}
	]
}

This is part of the "parsedStack" data and the value is essentially a really long url coming from a third party so I can't make any changes to it. I know some of the values get shortened by the "DataSantizer", but this one clearly isn't. Not sure if this is a bug or a matter of configuration. Would really appreciate any help on this! Thanks!

Steps to Reproduce

  • OS/Browser: any
  • SDK Version [e.g. 22]:
    "@microsoft/applicationinsights-react-js": "^3.4.0",
    "@microsoft/applicationinsights-web": "^2.8.9",
  • How you initialized the SDK: Connection string

Expected behavior
Error is logged.

Additional context
Other errors are logged as expected, it's just this particular error and call stack that contains a long url that is over 1024 characters.

@MSNev
Copy link
Collaborator

MSNev commented Feb 10, 2023

In the short term, you should be able to use a telemetry initializer to truncate this value.
https://github.com/Microsoft/ApplicationInsights-JS#telemetry-initializers

Where you will need to inspect the name of the event (called envelope in the readme), just be aware that a telemetry initializer callback function is called for every event that is sent, so you should make sure that when updating the event that any embedded object may not exist and you should limit the amount of code that is executed unnecessarily.

Another option with using a telemetry initializer, is that if this is coming from a 3rd party and you don't want it to be included in your AzureMonitor portal exception data you can simply return false; from the initializer which will cause the event to never be sent.

@MSNev
Copy link
Collaborator

MSNev commented Feb 10, 2023

@siyuniu-ms this is probably a good first item for you to look at, basically we need to reproduce and add some additional code to sanitize (truncate) this field using the existing functions.
tagging @Karlie-777 for awareness

@MSNev MSNev added this to the 2.8.11 milestone Feb 27, 2023
@Karlie-777
Copy link
Contributor

Karlie-777 commented Mar 3, 2023

@siyuniu-ms so this function

function _formatStackTrace(stackDetails: IStackDetails) {
transform error stack object into string. you may add dataSanitizeString to this value to make sure it is not exceeding max-string length as well

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