Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.
This repository was archived by the owner on Nov 20, 2025. It is now read-only.

fast-text-encoding pollutes global namespace, breaks other libraries #626

@modeswitch

Description

@modeswitch

Environment details

  • OS: Linux
  • Node.js version: 8.15.0
  • npm version: 6.7.0
  • google-auth-library version: 3.1.0

Steps to reproduce

This library relies on fast-text-encoding@1.0.0, which dumps TextEncoder and TextDecoder into the global namespace. Unfortunately, the polyfill implementations provided by fast-text-encoding are incomplete (they don't support UTF-8, for example) and this causes other libraries that rely on this functionality to break. For example, libraries built with Emscripten check for TextDecoder and will fail if google-auth-library is loaded.

Easy fix is to defer requiring browser/crypto and node/crypto until you know which environment you're in. Since TextEncoder and TextDecoder aren't needed for Node, that seems reasonable.

Metadata

Metadata

Labels

triage meI really want to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions