question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GRPC-JS Error: Metadata key contains illegal characters

See original GitHub issue

Environment details

  • OS: Debian (using node:10.15.0 Docker image)
  • Node.js version: v10.15.0
  • npm version: 6.4.1 (using yarn 1.12.3 though)
  • @google-cloud/logging-winston version: 1.1.0

Steps to reproduce

  1. Send logs via this logger
  2. Wait
  3. Get error caught by a reporting library, like Sentry in our case

I’ve been seeing this error coming up sporadically, with different characters in the key each time:

Error: Metadata key "�ˆé" contains illegal characters
  File "app:///../node_modules/@grpc/grpc-js/build/src/client.js", line 101, col 45, in Http2CallStream.call.on
    const error = Object.assign(new Error(status.details), status);
  File "events.js", line 187, col 15, in Http2CallStream.emit
  File "domain.js", line 459, col 23, in Http2CallStream.EventEmitter.emit
  File "app:///../node_modules/@grpc/grpc-js/build/src/call-stream.js", line 71, col 22, in process.nextTick
    this.emit('status', status);
  File "internal/process/next_tick.js", line 61, col 11, in process._tickCallback

It only appeared once we had a deployment with logging using this library, so I’m pretty sure it’s the logging transport, but can’t be 100% as the stack trace starts in the grpc-js dependency.

Since I don’t know where it is coming from, I don’t really know how debug it. I’m guessing because the work is offloaded to the next tick I wouldn’t even be able to catch the library error in my client code either 🤷‍♀

I found this related upstream issue: https://github.com/grpc/grpc-node/issues/519

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
alexander-fenstercommented, Jul 15, 2019

Hi @daaain,

We have released google-gax v1.1.5 that pulls @grpc/grpc-js v0.5.2 in which the invalid headers (that are coming from Node.js http2 module) are printed in a warning, but do not throw exception. Please upgrade your dependencies, it should fix the problem for you.

1reaction
DominicKramercommented, Jul 8, 2019

Thank you for opening this issue. I’m transferring the issue to nodejs-logging since interactions with the logging API are not done by this library but are instead done using the nodejs-logging library. As such, I don’t think this issue is specific to the nodejs-logging-winston library.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Metadata key contains illegal characters · Issue #415 - GitHub
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 ...
Read more >
Class Metadata.Key<T> - gRPC on GitHub
Key for metadata entries. Allows for parsing and serialization of metadata. Valid characters in key names. Only the following ASCII characters are allowed ......
Read more >
Metadata key contains illegal characters - Bountysource
Metadata key contains illegal characters. ... We've started noticing a new error in production (and in staging env also) that happens ~50 ...
Read more >
Sending metadata in gRPC message - Google Groups
Regarding disallowed characters: Normal metadata fields are allowed ASCII codepoints 32 through 126 inclusive (so, control characters and DEL are disallowed).
Read more >
metadata.go - Google Git
package metadata // import "google.golang.org/grpc/metadata". import ( ... Only the following ASCII characters are allowed in keys: // - digits: 0-9.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found