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.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
NawarAcommented, Aug 10, 2020

Yup. Deleting package-lock.json and node_modules/ fixes it (in case you want a work-around)

2reactions
Ezardcommented, Aug 9, 2020

@npomfret 2.3.0 works fine for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read properties of undefined (reading 'on')
after update my project electron (19) will not start. i got the error. Uncaught TypeError: Cannot read properties of undefined (reading ...
Read more >
cannot read properties of undefined (reading 'filter') angular
To solve the "Cannot read properties of undefined" error, make sure to insert the JS script tag at the bottom of the body....
Read more >
JS error "Cannot read property 'timestamp'" at checkout after ...
I upgraded Magento 2.3.3 to 2.4.2-p1 and at the checkout it presents this error and just keeps loading the checkout. Uncaught TypeError: ...
Read more >
Uncaught TypeError: Cannot read property of undefined In
This error occurs in Chrome Browser when you read a property or call a method on an undefined object . There are a...
Read more >
Changelog - Cypress Documentation
When a chromium based browser tab or process crashes, Cypress will no ... where Cypress would crash with TypeError: Cannot read property 'length'...
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