Skip to content
This repository was archived by the owner on Mar 17, 2026. It is now read-only.
This repository was archived by the owner on Mar 17, 2026. It is now read-only.

"TypeError: Cannot read property 'Reader' of undefined" after upgrading to 2.4.0 #1082

@Ezard

Description

@Ezard

Environment details

  • OS: Windows 10 (my machine) and Ubuntu 18.04 (GitHub Action runner)
  • Node.js version: 12.14
  • npm version: 6.14.5
  • @google-cloud/pubsub version: 2.4.0
  • Typescript version: 3.9.7

Steps to reproduce

  1. Import anything from @google-cloud/pubsub@2.4.0 (e.g. Message), and use it
  2. Run the code
  3. The following error will occur:
TypeError: Cannot read property 'Reader' of undefined

  at ../node_modules/@google-cloud/pubsub/build/protos/protos.js:28:29
  at ../node_modules/@google-cloud/pubsub/build/protos/protos.js:22:26
  at Object.<anonymous> (../node_modules/@google-cloud/pubsub/build/protos/protos.js:24:3)
  at Object.<anonymous> (../node_modules/@google-cloud/pubsub/src/index.ts:156:1)

Minimal reproduction:

import { Message } from '@google-cloud/pubsub';

describe('Test', () => {
  it('should work', () => {
    expect(Message).toBeDefined();
  });
});

I had a look through the diff between 2.3.0 and 2.4.0, but couldn't see anything suspect. I did try downgrading my Typescript version to 3.8.3 to match what this library was compiled with, but the same error occurs

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: pubsubIssues related to the googleapis/nodejs-pubsub API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions