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] Behavior difference for an empty endpointUrl when upgrading from v1 to v2 #1890

Closed
MSNev opened this issue Aug 24, 2022 · 1 comment
Closed
Milestone

Comments

@MSNev
Copy link
Collaborator

MSNev commented Aug 24, 2022

In version 1.X when endpointUrl is an “” empty string, AppInsights will fall back to the default endpoint, for example, https://dc.services.visualstudio.com/v2/track. The new version of the SDK doesn’t have this fallback logic, so we need exclude endpointUrl from the AppInsights config when it’s an empty string, to fall back to the default url.

Previously we do

aiConfig = {
    endpointUrl: window.appInsightsV2EndpointUrl ?? null // assign “” to aiConfig endpointUrl anyway
    instrumentationKey: window.appInsightsV2InstrKey
};

now we must check if the url is an empty string

aiConfig = {
    instrumentationKey: window.appInsightsV2InstrKey
};

if (window.appInsightsV2EndpointUrl && window.appInsightsV2EndpointUrl.length !== 0) {  // only configure endpointUrl if url is valid
    aiConfig.endpointUrl = window.appInsightsV2EndpointUrl;
}
@MSNev MSNev added this to the 2.8.7 milestone Aug 24, 2022
@MSNev MSNev added the fixed - waiting release PR Committed and waiting deployment label Aug 25, 2022
@MSNev MSNev closed this as completed Sep 14, 2022
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant