-
Notifications
You must be signed in to change notification settings - Fork 235
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
Make AI JS SDK for with NativeScript-Angular #1375
Comments
I've published an updated shims package with the fix, but the dependencies for the existing published packages will need to wait for the next release. |
@MSNev Thanks a lot. Is there some kind of pre-release channel where i can grab this and test is with my app? |
We don't currently have a pre-release channel, but you should be able to clone the repo locally and build. |
@dmytro-gokun Have you managed to get this working in your application? I've cloned the repo to get the updated shims as MSNev suggested, I get no compilation or runtime errors but nothing gets captured in my application insights |
@GlenCroft Yes, i gave it a try and got the same results as yours :(. Unfortunately, at the moment, I'm working on another task and this one has been postponed. So, I had no chance to dig deeper. If you have time and are willing to do that - I will send some rays of power your way 🔋 |
I've traced it down to this check which is seemingly in place to fall back to XDomainRequest for IE8/9
"withCredentials" isn't a property of XMLHttpRequest in the Nativescript application, my test output shows: AI TEST XHR: { I modifed the code for this check and I got a successful pageView logged in application insights, albeit missing the session_id, user_id and timing information. @MSNev Do you think there's any way we could add config to force the use of XMLHttpRequest or something? |
@GlenCroft Great job. I hope, this will finally work as expected. |
Looking at the code and the definition of XMLHttpRequest (https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials) there is currently no config option to directly "bypass" that check. However, the simplest option I can think of (as long as the XMLHttpRequest object is not read only) would be before initializing the SDK would be to just "add" a prototype property for withCredentials with a value of false, so that this check "if ("withCredentials" in testXhr)" would therefore be true... The only option (which I'll add an Issue for) would be to add an "override" method, to allow you to completely take over the sending request. This was always part of a longer term option as part of merging some internal extensions, but we don't have an explicit timeline for this. |
OK, I've created the following feature request to provide this ability I don't have a timeline at this point as I'm currently in the process of creating the current 2.5.9 release (core was released to NPM late yesterday -- I provide and update the detailed timeline as I do the release on the milestone instances.) |
Closing as 2.5.9 is now completely deployed to NPM and all CDN endpoints |
React v3.1.1 and ReactNative v2.3.1 are now published to NPM |
I've deprecated the react v3.1.1 and react-native v2.3.1 packages until I can publish an updated versions #1553 |
I'm updating #1553 with the current state, please see comments there for additional info. @xiao-lix For Angular, this will need a new release to address (remove the need for) __extends and __assigns without the globals or webpack ProviderPlugin work-arounds.
I can help you or work on it tomorrow. |
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. |
I'm trying to make AI JS SDK work with my NativeScript-Angular application. It compiles fine, but then I get a runtime exception:
I've investigated it a bit and can say that it all boils down to these lines:
ApplicationInsights-JS/tools/shims/src/applicationinsights-shims.ts
Line 116 in 712f13e
and
ApplicationInsights-JS/tools/shims/src/applicationinsights-shims.ts
Line 121 in 712f13e
So, an attempt is made here to modify a read-only property. This can be easily worked around by checking if that property is falsy first. So, instead of:
it should do:
Also, instead of:
it should do:
It is less idiomatic, but it does the job.
Does it all make sense or am I wasting time attempting to make AI & NS work together?
Thanks.
The text was updated successfully, but these errors were encountered: