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] error thrown using basic version + NPM setup #1875

Closed
lindsayevans opened this issue Aug 5, 2022 · 2 comments
Closed

[BUG] error thrown using basic version + NPM setup #1875

lindsayevans opened this issue Aug 5, 2022 · 2 comments

Comments

@lindsayevans
Copy link
Contributor

Description/Screenshot

I've installed the basic version using NPM, but attempting to initialise results in a JS error in the DevTools console:

index.js:34 Uncaught TypeError: _self.getSKUDefaults is not a function
    at index.js:34:1
    at dynamicProto (DynamicProto.js:514:1)
    at new ApplicationInsights (index.js:32:1)
    at jeorp.@microsoft/applicationinsights-web-basic (main.ts:3:21)
    at newRequire (index.b7a05eb9.js:71:24)
    at index.b7a05eb9.js:122:5
    at index.b7a05eb9.js:145:3

Steps to Reproduce

npm i --save @microsoft/applicationinsights-web-basic
import { ApplicationInsights } from '@microsoft/applicationinsights-web-basic';

const appInsights = new ApplicationInsights({
  instrumentationKey: 'd999b489-4274-4a38-9526-0964fd808627',
});

Full code available here: https://github.com/lindsayevans/linz.id.au/tree/develop/src

Can be seen in action here: https://yellow-smoke-042698a1e-develop.westus2.1.azurestaticapps.net/

  • OS/Browser: macOS 10.15.7, Chrome 103
  • SDK Version [e.g. 22]: 2.8.6
  • How you initialized the SDK:

Expected behavior

Additional context

Checking the location from the error (node_modules/@microsoft/applicationinsights-web-basic/dist-esm/index.js:34:1), it looks like getSKUDefaults is called before being defined:

_self.getSKUDefaults();
_initialize();
_self[_DYN_INITIALIZE /* @min:%2einitialize */] = _initialize;
_self.getSKUDefaults = function () {

Seems to be occurring with all 2.8.* versions, but works as expected with v2.7.6

npm i --save @microsoft/applicationinsights-web-basic@2.7.6
@lindsayevans
Copy link
Contributor Author

FYI: just tested against the nightly build & everything looks good

@MSNev MSNev closed this as completed Sep 14, 2022
MSNev added a commit to MSNev/ApplicationInsights-JS that referenced this issue Oct 3, 2022
* [BUG] Snippet initialization with IE8/9 fails with minified code (works with un-minified code) microsoft#1852 (microsoft#1854)

* [BUG] CDN Packaging is not exposing the internal tools (CoreUtils / Telemetry / etc) microsoft#1857 (microsoft#1858)

* fix stopTrackEvents (microsoft#1859)

Co-authored-by: Nev <54870357+MSNev@users.noreply.github.com>

* Refactor code to provide better tree shaking and minification of generated code microsoft#1076 (microsoft#1811)

- Add Automatic Name replacing / Crunching

* Address Component Governance issues (microsoft#1860)

- Update npm to 8.13.2
- Update rush to 5.75.0

* [Release] Increase version to 2.8.5 (microsoft#1861)

- Updates React Plugin to v3.3.5 (with v2.8.5 as dependency) -- using React 17
- Updates React Native Plugin to 2.5.5 (with v2.8.5 as dependency)
- Updates Chrome Debug Extension to 0.3.5

* Update and add legal compliance notices and license terms (microsoft#1865)

* Remove React-JS and React-Native code from this repo (microsoft#1866)

* [BUG] Remote Dependency requests don't "always" have the correct ai.operation.id tag (page view race condition) microsoft#1862 (microsoft#1869)

* [BUG] Performance improvements when calling newGuid multiple times (like 10,000) microsoft#1870 (microsoft#1871)

* [Release] Increase version to 2.8.6 (microsoft#1872)

* add click plugin url config back (microsoft#1874)

* fix(AISKULight): call getSKUDefaults after it's defined, change this.config references to _self (microsoft#1876)

Closes: microsoft#1875

* Merge master to beta @ 6ba2c0d

Co-authored-by: Karlie-777 <79606506+Karlie-777@users.noreply.github.com>
Co-authored-by: Lindsay Evans <linz@linz.id.au>
@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

2 participants