Skip to content

Datadog Tracer throws Uncaught Exception on Error Code 13 #747

Description

@iveelsm

Describe the bug

When a gRPC Request fails with an error code 13 from a failure to parse like so:

content_1    |     err: {
content_1    |       "type": "Error",
content_1    |       "message": "13 INTERNAL: Failed to parse server response",
content_1    |       "stack":
content_1    |           Error: 13 INTERNAL: Failed to parse server response
content_1    |               at Object.exports.createStatusError (/home/app/content/node_modules/grpc/src/common.js:91:15)
content_1    |               at Object.onReceiveStatus (/home/app/content/node_modules/grpc/src/client_interceptors.js:1204:28)
content_1    |               at InterceptingListener._callNext (/home/app/content/node_modules/grpc/src/client_interceptors.js:568:42)
content_1    |               at InterceptingListener.onReceiveStatus (/home/app/content/node_modules/grpc/src/client_interceptors.js:618:8)
content_1    |               at callback (/home/app/content/node_modules/grpc/src/client_interceptors.js:845:24)
content_1    |       "code": 13,
content_1    |       "details": "Failed to parse server response"
content_1    |     }

The datadog gRPC plugin will throw an uncaught error that causes the server to terminate when enabled. This is the output from that error:

content_1    | /home/app/content/node_modules/dd-trace/packages/datadog-plugin-grpc/src/util.js:28
content_1    |     const values = filter(metadata.getMap())
content_1    |                                    ^
content_1    | TypeError: Cannot read property 'getMap' of undefined
content_1    |     at addMetadataTags (/home/app/content/node_modules/dd-trace/packages/datadog-plugin-grpc/src/util.js:28:36)
content_1    |     at ClientUnaryCall.call.emit (/home/app/content/node_modules/dd-trace/packages/datadog-plugin-grpc/src/client.js:100:9)
content_1    |     at Object.onReceiveStatus (/home/app/content/node_modules/grpc/src/client_interceptors.js:1209:15)
content_1    |     at InterceptingListener._callNext (/home/app/content/node_modules/grpc/src/client_interceptors.js:568:42)
content_1    |     at InterceptingListener.onReceiveStatus (/home/app/content/node_modules/grpc/src/client_interceptors.js:618:8)
content_1    |     at callback (/home/app/content/node_modules/grpc/src/client_interceptors.js:845:24)

This will cause the NodeJS process to terminate in spite of the fact that it could handle these errors normally without the Datadog Agent enabled.

Environment
Production

  • **Operation system: **
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
  • Node version:
v10.16.3
  • Tracer version:
dd-trace-0.15.2
  • Agent version:
    N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions