I am trying to integrate the stackdriver-error-js library into my Vue project as a module.

The code and the setup:

in package.json

    "stackdriver-errors-js": "^0.2.0"

in bootstrap.js

   import errorHandler from './error/error-reporting';

in error-reporting.js

import { StackdriverErrorReporter } from 'stackdriver-errors-js';   

let errorHandler;

errorHandler = new StackdriverErrorReporter();   
    key: "{{.Config.StackDriverApiKey}}",
    projectId: "{{.Config.StackDriverProject}}",
    service: "{{.Config.GoogleCloudProjectID}}",
    version: "{{.Copacknfig.GaeEnv}}",
    disabled: false

export default errorHandler;

The actual error

The error I got now is (console output and test)

[vue-devtools] Ready. Detected Vue v2.4.2
(function testErrorReporting() {window.onerror(null, null, null, null, new Error('Test: Something broke!'));})();

stackdriver-errors.js:109 Uncaught ReferenceError: StackTrace is not defined
    at StackdriverErrorReporter.webpackJsonp.556.StackdriverErrorReporter.report (stackdriver-errors.js:109)
    at window.onerror (stackdriver-errors.js:67)
    at testErrorReporting (<anonymous>:1:40)
    at <anonymous>:1:111

and line (stackdriver-errors.js:109)


1 Answers 11

If you do not load the stackdriver-errors-concat.min.js file, you also manually need to also the stacktrace-js module.

stackdriver-errors expects a StackTrace object to be present.

thanks, I get it. Now trying to get the that module imported and working... – jongep86

Not the answer you're looking for? Browse other questions tagged or ask your own question.