Hi,
I receive Error - Already initialized whenever I initialized insights-js on my next-js application. How can I solve this? I just moved my application from create-react-app where it does work properly to next-js.
My _app.js
import {init, trackPages} from 'insights-js'
init(myKey);
trackPages();
Full console error:
Error: Already initialized!
at Object.init (/node_modules/insights-js/dist/insights-js.cjs.js:366:15)
at eval (webpack-internal:///./pages/_app.tsx:17:13)
at Object../pages/_app.tsx (/.next/server/pages/_app.js:231:1)
at __webpack_require__ (/.next/server/webpack-runtime.js:33:42)
at __webpack_exec__ (/next/server/pages/_app.js:701:39)
at /.next/server/pages/_app.js:702:28
at Object.<anonymous> (/.next/server/pages/_app.js:705:3)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
error - Error: Already initialized!
Error: Already initialized!
at Object.init (/node_modules/insights-js/dist/insights-js.cjs.js:366:15)
at eval (webpack-internal:///./pages/_app.tsx:17:13)
at Object../pages/_app.tsx (/.next/server/pages/_app.js:231:1)
at __webpack_require__ (/.next/server/webpack-runtime.js:33:42)
at __webpack_exec__ (/.next/server/pages/_app.js:701:39)
at /.next/server/pages/_app.js:702:28
at Object.<anonymous> (/.next/server/pages/_app.js:705:3)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
Hi, I receive
Error - Already initialized
whenever I initializedinsights-js
on my next-js application. How can I solve this? I just moved my application fromcreate-react-app
where it does work properly tonext-js
.My _app.js
Full console error: