stackdriver-errors-js icon indicating copy to clipboard operation
stackdriver-errors-js copied to clipboard

Unexpected token < in JSON at position 0

Open ernsheong opened this issue 6 years ago • 3 comments

image

I have a bug in production (3rd error), the surrounding first 2 and latter 2 are mysterious to me. Can anyone explain further?

ernsheong avatar Jun 08 '19 16:06 ernsheong

See upstream merge proposal https://github.com/stacktracejs/stacktrace-gps/pull/57 which may not be the right fix, but is this issue.

In short, your source map is not valid JSON for some reason. Probably the error should be handleable at the stackdriver-errors-js level, but at the moment is not propagated up.

bz2 avatar Jun 11 '19 11:06 bz2

Thanks. The panaroid developer in me decided not to expose sourcemaps for fear of losing IP. Let me know if that shouldn't be a cause of concern... I think protection mechanisms for sourcemaps are still clunky.

So perhaps sourcemaps should be made optional. Bonus points if sourcemaps can be exposed only to Stackdriver, done securely.

ernsheong avatar Jun 11 '19 16:06 ernsheong

That's fair enough, and see https://github.com/GoogleCloudPlatform/stackdriver-errors-js/issues/4 for supporting private sourcemaps. If you're scrubbing sourcemaps for prod deploy though, you should also scrub the url reference from the bottom of the source files to avoid this bug.

bz2 avatar Jun 11 '19 16:06 bz2