Closed wadehammes closed 4 years ago
Hey @wadehammes. The warn message should list the line number in the browser console like index.esm.js:185
. Can you set a breakpoint there and on line 190 indow._fs_initialized = true;
just to absolutely confirm the init
isn't being called twice? This would be the first report that we're somehow double loading the SDK.
Regarding the identify
call, everything appears correct. The user.user
value should be a GUID. See the developer doc here for more details.
@van-fs here is the full console warning:
FullStory init has already been called once, additional invocations are ignored
at App (http://localhost:3000/static/js/main.chunk.js:1531:3)
at y (http://localhost:3000/static/js/0.chunk.js:59274:17)
at l (http://localhost:3000/static/js/0.chunk.js:59137:18)
at Router (http://localhost:3000/static/js/0.chunk.js:164740:30)
at BrowserRouter (http://localhost:3000/static/js/0.chunk.js:164360:35)
When opening the first stacktrace, its just the app code. The remaining traces aren't getting to the line you mention. Anything else you recommend?
Here are the lines from stacktrace above:
cov_1wsvy9wvbh.s[9]++;
_fullstory_browser__WEBPACK_IMPORTED_MODULE_12__["init"]({
orgId: '<org id>'
});
cov_1wsvy9wvbh.s[10]++;
_fullstory_browser__WEBPACK_IMPORTED_MODULE_12__["identify"](`${user.user}`, {
displayName: `${user.first_name} ${user.last_name}`,
email: `${user.auth.email}`,
application: 'contributor-search'
});
Can you also show us where the FS.init()
resides in your App code? Perhaps its placement is leading to the SDK being doubly invoked.
If the app has been through a build and webpacked, I can't provide a line number, and this is a bit more challenging. The same process does apply though. You can open main.chunk.js, and click the "pretty print" option in Chrome. You'll then have to search for _fs_initialized
. The first match should be when we warn
and the second is when the SDK first init
s. You can try setting breakpoints for both matched lines to see the call stack. It may be difficult to interpret since webpack is going to minify all the code. It would be ideal to investigate in a dev environment prior to building. Perhaps there's a react-scripts start
command similar to our react-shoppe-demo.
Hey @wadehammes I see a React Router invocation in the stack trace before you get the "multiple initialization" warning from FullStory. Is it possible App
could be getting mounted multiple times, thus invoking FS.init
multiple times?
I invoke FS.init
outside of App and the Router, as soon as React bootstraps in index.tsx: https://github.com/fullstorydev/react-shoppe-demo/blob/master/src/index.tsx
Is this something you can try as well?
Hi @wadehammes - I'm checking in on this issue. Was my suggestion helpful? Were you able to eliminate the warnings by relocating the FS.init
invocation?
@wadehammes I'm going to close this issue. Please let us know if my suggestion fro July 4 isn't working for you.
React 16.13.1
Getting the above console warning using the NPM package. I am only calling the init method once in my
<App />
component:This is how I am calling it. Is there a better way to do identify with the NPM package?