warrmr opened a new issue, #8812:
URL: https://github.com/apache/skywalking/issues/8812

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Apache SkyWalking Component
   
   NodeJS Client Side Agent (apache/skywalking-client-js)
   
   ### What happened
   
   When integrating the skywalking-client-js into a Vue app it produces the 
following exception on first load/route change, this is an unexpected error and 
appears to be coming from inside of the skywalking module. 
   
   ```
   index.js:1 Uncaught (in promise) TypeError: Cannot read properties of 
undefined (reading 'time')
   at t.getFmpTime (index.js:1:10849)
   at t.calculateFinalScore (index.js:1:10584)
   at t.initObserver (index.js:1:10089)
   at new t (index.js:1:9507)
   at t.<anonymous> (index.js:1:14774)
   at index.js:1:14473
   at Object.next (index.js:1:13789)
   at a (index.js:1:15191)
   ```
   
   
   This is how I have it setup in the Vue app. 
   
   ```main.js
   import ClientMonitor from "skywalking-client-js";
   import { name, version } from "../package.json";
   
   console.info(`App Version: ${version}`);
   
   Vue.config.productionTip = false;
   Vue.config.errorHandler = (error) => {
       ClientMonitor.reportFrameErrors(
           {
               collector: "https://skywalking.8av.co.uk";,
               service: name,
               pagePath: router.currentRoute,
               serviceVersion: `v${version}`,
               vue: true,
           },
           error,
       );
   };
   
   ```
   
   ```router.js
   import Vue from "vue";
   import VueRouter from "vue-router";
   import ClientMonitor from "skywalking-client-js";
   import routes from "./routes";
   import { name, version } from "../../package.json";
   
   
   Vue.use(VueRouter);
   
   const router = new VueRouter({
       mode: "history",
       base: process.env.BASE_URL,
       routes,
   });
   
   router.beforeEach(async (to, _from, next) => {
       ClientMonitor.setPerformance({
           collector: "https://skywalking.8av.co.uk";,
           service: name,
           pagePath: to.path,
           serviceVersion: `v${version}`,
           useFmp: true,
           vue: true,
       });
   
       return next();
   });
   
   export default router;
   ```
   
   ### What you expected to happen
   
   No errors to be shown in the Chrome Console being generated from inside the 
NPM package,
   
   ### How to reproduce
   
   Drop in the above code into a Vue project and run it against a skywalking 
server. 
   
   ### Anything else
   
   Happens on first page load/transition then seems to work fine therfore 
after. 
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to