Skip to content

Unhandled Promise rejection: toISOString is not a function ; Zone: <root>  #1798

@kevcjones-archived

Description

@kevcjones-archived

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

4.4.1

Description

An API endpoint threw this

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Request Error</title>
    <style>BODY { color: #000000; background-color: white; font-family: Verdana; margin-left: 0px; margin-top: 0px; } #content { margin-left: 30px; font-size: .70em; padding-bottom: 2em; } A:link { color: #336699; font-weight: bold; text-decoration: underline; } A:visited { color: #6699cc; font-weight: bold; text-decoration: underline; } A:active { color: #336699; font-weight: bold; text-decoration: underline; } .heading1 { background-color: #003366; border-bottom: #336699 6px solid; color: #ffffff; font-family: Tahoma; font-size: 26px; font-weight: normal;margin: 0em 0em 10px -20px; padding-bottom: 8px; padding-left: 30px;padding-top: 16px;} pre { font-size:small; background-color: #e5e5cc; padding: 5px; font-family: Courier New; margin-top: 0px; border: 1px #f0f0e0 solid; white-space: pre-wrap; white-space: -pre-wrap; word-wrap: break-word; } table { border-collapse: collapse; border-spacing: 0px; font-family: Verdana;} table th { border-right: 2px white solid; border-bottom: 2px white solid; font-weight: bold; background-color: #cecf9c;} table td { border-right: 2px white solid; border-bottom: 2px white solid; background-color: #e5e5cc;}</style>
  </head>
  <body>
    <div id="content">
      <p class="heading1">Request Error</p>
      <p>The server encountered an error processing the request. See server logs for more details.</p>
    </div>
  </body>
</html>

Inside the Error handler as per your docs, the following error message blow up my change detection

Unhandled Promise rejection: toISOString is not a function ; Zone: <root> ; Task: Promise.then ; Value: TypeError: toISOString is not a function
    at String.toJSON (<anonymous>)
    at Object.eval (_ctx.js:18)
    at JSON.stringify (<anonymous>)
    at serialize (index.js:831)
    at BeaconTransport.eval (index.js:2804)
    at step (tslib.es6.js:97)
    at Object.eval [as next] (tslib.es6.js:78)
    at eval (tslib.es6.js:71)
    at new ZoneAwarePromise (zone.js:891)
    at Object.__awaiter (tslib.es6.js:67)
    at BeaconTransport.captureEvent (index.js:2801)
    at BrowserBackend.eval (index.js:2946)
    at step (tslib.es6.js:97)
    at Object.eval [as next] (tslib.es6.js:78)
    at eval (tslib.es6.js:71)
    at new ZoneAwarePromise (zone.js:891)
    at Object.__awaiter (tslib.es6.js:67)
    at BrowserBackend.sendEvent (index.js:2921)
    at BrowserClient.eval (baseclient.js:157)
    at step (tslib.es6.js:97)
    at Object.eval [as next] (tslib.es6.js:78)
    at eval (tslib.es6.js:71)
    at new ZoneAwarePromise (zone.js:891)
    at Object.__awaiter (tslib.es6.js:67)
    at eval (baseclient.js:156)
    at BrowserClient.eval (baseclient.js:334)
    at step (tslib.es6.js:97)
    at Object.eval [as next] (tslib.es6.js:78)
    at fulfilled (tslib.es6.js:68)
    at ZoneDelegate.invoke (zone.js:388)
    at Zone.run (zone.js:138)
    at eval (zone.js:872)
    at ZoneDelegate.invokeTask (zone.js:421)
    at Zone.runTask (zone.js:188)
    at drainMicroTaskQueue (zone.js:595)
    at ZoneTask.invokeTask [as invoke] (zone.js:500)
    at invokeTask (zone.js:1540)
    at XMLHttpRequest.globalZoneAwareCallback (zone.js:1566) TypeError: toISOString is not a function
    at String.toJSON (<anonymous>)
    at Object.eval (webpack-internal:///./node_modules/core-js/modules/_ctx.js:18:15)
    at JSON.stringify (<anonymous>)
    at serialize (webpack-internal:///./node_modules/@sentry/browser/dist/index.js:831:17)
    at BeaconTransport.eval (webpack-internal:///./node_modules/@sentry/browser/dist/index.js:2804:24)
    at step (webpack-internal:///./node_modules/tslib/tslib.es6.js:117:23)
    at Object.eval [as next] (webpack-internal:///./node_modules/tslib/tslib.es6.js:98:53)
    at eval (webpack-internal:///./node_modules/tslib/tslib.es6.js:91:71)
    at new ZoneAwarePromise (webpack-internal:///./node_modules/zone.js/dist/zone.js:891:29)
    at Object.__awaiter (webpack-internal:///./node_modules/tslib/tslib.es6.js:87:12)
    at BeaconTransport.captureEvent (webpack-internal:///./node_modules/@sentry/browser/dist/index.js:2801:24)
    at BrowserBackend.eval (webpack-internal:///./node_modules/@sentry/browser/dist/index.js:2946:54)
    at step (webpack-internal:///./node_modules/tslib/tslib.es6.js:117:23)
    at Object.eval [as next] (webpack-internal:///./node_modules/tslib/tslib.es6.js:98:53)
    at eval (webpack-internal:///./node_modules/tslib/tslib.es6.js:91:71)
    at new ZoneAwarePromise (webpack-internal:///./node_modules/zone.js/dist/zone.js:891:29)
    at Object.__awaiter (webpack-internal:///./node_modules/tslib/tslib.es6.js:87:12)
    at BrowserBackend.sendEvent (webpack-internal:///./node_modules/@sentry/browser/dist/index.js:2921:24)
    at BrowserClient.eval (webpack-internal:///./node_modules/@sentry/core/dist/baseclient.js:157:77)
    at step (webpack-internal:///./node_modules/tslib/tslib.es6.js:117:23)
    at Object.eval [as next] (webpack-internal:///./node_modules/tslib/tslib.es6.js:98:53)
    at eval (webpack-internal:///./node_modules/tslib/tslib.es6.js:91:71)
    at new ZoneAwarePromise (webpack-internal:///./node_modules/zone.js/dist/zone.js:891:29)
    at Object.__awaiter (webpack-internal:///./node_modules/tslib/tslib.es6.js:87:12)
    at eval (webpack-internal:///./node_modules/@sentry/core/dist/baseclient.js:156:115)
    at BrowserClient.eval (webpack-internal:///./node_modules/@sentry/core/dist/baseclient.js:334:46)
    at step (webpack-internal:///./node_modules/tslib/tslib.es6.js:117:23)
    at Object.eval [as next] (webpack-internal:///./node_modules/tslib/tslib.es6.js:98:53)
    at fulfilled (webpack-internal:///./node_modules/tslib/tslib.es6.js:88:58)
    at ZoneDelegate.invoke (webpack-internal:///./node_modules/zone.js/dist/zone.js:388:26)
    at Zone.run (webpack-internal:///./node_modules/zone.js/dist/zone.js:138:43)
    at eval (webpack-internal:///./node_modules/zone.js/dist/zone.js:872:34)
    at ZoneDelegate.invokeTask (webpack-internal:///./node_modules/zone.js/dist/zone.js:421:31)
    at Zone.runTask (webpack-internal:///./node_modules/zone.js/dist/zone.js:188:47)
    at drainMicroTaskQueue (webpack-internal:///./node_modules/zone.js/dist/zone.js:595:35)
    at ZoneTask.invokeTask [as invoke] (webpack-internal:///./node_modules/zone.js/dist/zone.js:500:21)
    at invokeTask (webpack-internal:///./node_modules/zone.js/dist/zone.js:1540:14)
    at XMLHttpRequest.globalZoneAwareCallback (webpack-internal:///./node_modules/zone.js/dist/zone.js:1566:17)

This prevented my modal for sign in from rendering to the screen.

I have found a work around where i simply don't give you this error message and handle the error locally, however i'd like some insights if you have any as to why the serializer inside @sentry has trouble parsing some XML?

some extra info

Browser witnessed in Chrome 70

Angular CLI: 1.7.3
Node: 9.6.1
OS: linux x64
Angular: 5.2.11
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.7.3
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.4.2
webpack-bundle-analyzer: 2.13.1
webpack: 3.11.0

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions