Description
We've started noticing a new error in production (and in staging env also) that happens ~50 times a day for us (for many thousands or maybe even millions of calls per day, don't have exact number). It looks like this in a stacktrace:
unhandledRejection: {
Error: Metadata key "a" contains illegal characters
at Http2CallStream.call.on (/ncbackend3/node_modules/@grpc/grpc-js/build/src/client.js:102:45)
at Http2CallStream.emit (events.js:194:15)
at Http2CallStream.EventEmitter.emit (domain.js:459:23)
at Http2CallStream.endCall (/ncbackend3/node_modules/@grpc/grpc-js/build/src/call-stream.js:74:18)
at ClientHttp2Stream.stream.on (/ncbackend3/node_modules/@grpc/grpc-js/build/src/call-stream.js:205:30)
at ClientHttp2Stream.emit (events.js:189:13)
at ClientHttp2Stream.EventEmitter.emit (domain.js:459:23) at emit (internal/http2/core.js:236:8)
at process._tickCallback (internal/process/next_tick.js:63:19)
code: 2,
details: 'Metadata key "a\u0000\u0000\u0000" contains illegal characters',
metadata: Metadata { internalRepr: Map {} },
note: 'Exception occurred in retry method that was not classified as transient' }
I've even seen this error myself once while calling a certain endpoint that was doing 1 query and 2-3 getById
calls to Datastore. So, no save
s was made, only querying.
This error is not reproducible all the time, as I mentioned, rather "rare", but still noticeable (~50 hard errors every day, that end up in http 500 errors for our api users).
I don't know how to dig further and provide other helpful info. Important to note that it only happened after updating from ^3.0.0
(latest version in 3.x.x) to 4.0.0
. I'm assuming the error could somewhere downstream (in grpc-js
itself) that was updated as a sub-dependency. We're on the latest version of everything as of today (yarn upgrade
was done and we have no deps pinned).
ps: forgot to add that the "key" in the metadata has different values in each other error (we see it in Sentry), examples (err.message
here):
Metadata key "a" contains illegal characters
Metadata key " �û·" contains illegal characters
Metadata key " �`ñ" contains illegal characters
Metadata key " r�ð" contains illegal characters
Metadata key " òe×" contains illegal characters
Metadata key " �wâ" contains illegal characters
...
pps: we were using .runQuery()
method with 2 simple filters by number
fields and .get(key)
(that's what I called getById
). Same code in 3.x.x
version worked just fine.
Noticed that a
occured more often than others.
Environment details
- OS: node:10-alpine official docker image
- Node.js version: 10.15.3
- npm version: not applicable
@google-cloud/datastore
version: 4.0.0