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] Snippet Setup example code error. #2181
Comments
It is very strange that it is preceded by: f.queue = [] So why can't I access push? I solved the error by doing this, but I don't know if there are any side effects. (f.queue&&f.queue.push(xxx)) |
Hmm, this looks like the "snippet" (SDK Loader code) and not the main SDK. The "uncompressed" version of sv:"6" is located here https://github.com/microsoft/ApplicationInsights-JS/blob/main/AISKU/snippet/snippet.js And the current version (sv:"7") we converted into TypeScript and is located here https://github.com/microsoft/ApplicationInsights-JS/blob/main/tools/applicationinsights-web-snippet/src/snippet.ts, it is unexpected that the So it seems there might be something else going on for the sequence where the default (initial) "instance" (created on lines 38..44) doesn't seem to be running. |
Thanks. I will test the snippet with the source code. |
I think it like the line:
|
Yes, that is the line I would expect matches the minified above, but, I would not expect the @siyuniu-ms Can you see if you can reproduce this issue. |
Hi @zh-pan , I tried to reproduce it by running sv version 7: I commented out the src string for edge case and add breadpoint but didn't reproduce the problem. Could you provide more detail about how to reproduce the problem? Thanks! |
@siyuniu-ms I can't provide more because it is random. Sorry. |
Sounds like a race condition, where the This can happen when
Unless they are loading via the CDN where you can "see" the multiple network requests in the F12 network tab, this can be a difficult issue to detect. Looking at the "names" of |
@MSNev Maybe you are right. |
A 302, itself won't necessarily cause the race condition, but because of the additional delay required for the round trips of the request / response, then it might aid in the triggering of the issue. But the basic issue is multiple instances. I drilled into the code a little more and found the code inside of the SDK that once it initializes it calls the So another possible possibility
A further possibility, would be that if you (or something) caches the "proxy" function and call it then it will also continue to call the old proxyy rather than the replaced instance function. |
This code I can't debug because it confused.
Can you offer source code? Or help me debug the bug.
(It is random occurrence)
ai.2.min.js
The text was updated successfully, but these errors were encountered: