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.

🐛 BUG: bundle problem when using googleapis

See original GitHub issue

What version of Wrangler are you using?

2.0.26

What operating system are you using?

Windows

Describe the Bug

I am using two google official libraries to develope some features.

“google-auth-library”: “^8.2.0”, https://github.com/googleapis/google-auth-library-nodejs

“googleapis”: “^105.0.0”, https://github.com/googleapis/google-api-nodejs-client

I wirite node_compat = true on wrangler.toml, and then I run npm run start It says:

X [ERROR] Could not resolve "http2"
 node_modules/googleapis-common/build/src/http2.js:16:22:
    16 │ const http2 = require("http2");
         │                       ~~~~~~~
         ╵                       "./http2"

  The package "http2" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
jspspikecommented, Sep 6, 2022

We won’t be able to fix this within wrangler but we’ve created an internal issue to try to improve node_compat within the workers runtime. We’ll be closing this ticket for now

0reactions
Infinitaycommented, Sep 3, 2022

Yes I have tried adding node_compat = true but it resulted in the same issue as OP. Actually, with the same package too of http2.

Node Version: v16.13.1

For the time being I refactored my code to use the native fetch rather than got.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Errors | Cloud APIs - Google Cloud
Google APIs use a simple protocol-agnostic error model, which allows us to offer a consistent experience across different APIs, different API protocols ...
Read more >
Error while publishing AAB to internal sharing console after ...
As the error suggests, I tried validating bundle on my local machine and it's absolutely working fine and I'm even able to install...
Read more >
Error implementing GoogleApiClient Builder for Android ...
ConnectionCallbacks , it's asking for GoogleApiClient.ConnectionCallbacks . Try changing your implements to use the more-qualified class name.
Read more >
Setup Instructions | API Client Library for Java
The Google API Client Library for Java (google-api-client) is designed to be compatible with all supported Java platforms, including Android.
Read more >
Google APIs Node.js Client
Start using googleapis in your project by running `npm i googleapis`. ... This means that we will address critical bugs and security issues...
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