Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

googleapis incompatible with apps created by CreateReactApp #716

Closed
SomervilleTom opened this issue Nov 18, 2020 · 6 comments
Closed

googleapis incompatible with apps created by CreateReactApp #716

SomervilleTom opened this issue Nov 18, 2020 · 6 comments
Assignees
Labels
api: dialogflow Issues related to the googleapis/nodejs-dialogflow API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@SomervilleTom
Copy link

SomervilleTom commented Nov 18, 2020

This updates an earlier "closed" issue reporting what may be the same bug. I do not have a Google support contract.

My specific experience is exactly the same as reported earlier by "shivasuri" and others on the other issue. I'm running CentOS 7 on an AWS EC2 instance. I develop using Visual Studio Code (VSC) on a local robust Win10 Pro system using the "RemoteSSH" extension to connect to the target system. I keep an SSH connection from the local host to the remote target system at all times, and I forward various ports including 3000, 3001, and so on from the target system back to the local host. I use a local up-to-date Chrome browser, and I use the "Debugging in Chrome" extension in VSC.

Here are the various versions I'm running:

$ node --version
v14.15.0
$ npm --version
6.14.8
$ npx --version
6.14.8

I've installed googleapi following the guidance from the documentation:

$ npm install googleapis --save
$ npm install google-auth-library --save

When I attempt to start the react app, I see the same complaints reported above:

Module not found: Can't resolve 'http2' in 'node_modules/googleapis-common/build/src'

When I install http2 from the command line:

$npm i http2

I get the same failure reported above:

Compiled with warnings.

./node_modules/http2/lib/protocol/index.js

Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

It would be very helpful if a workaround (with enough detail for an npm/react newbie to follow) could be posted here, especially if this issue is to remain closed. It prevents me from using googleapis, and that in turn is blocking my ability to successfully continue development of my current project (which requires using the youtube v3 search api).

FWIW, I do not need http2 functionality or behavior.

@product-auto-label product-auto-label bot added the api: dialogflow Issues related to the googleapis/nodejs-dialogflow API. label Nov 18, 2020
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Nov 18, 2020
@munkhuushmgl munkhuushmgl self-assigned this Nov 20, 2020
@akshayravikumar
Copy link

I'm also having trouble using googleapis on a Next.js app - when I npm i http2 I'm running into Error: Cannot find module './framer' at runtime.

@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Nov 23, 2020
@bcoe bcoe added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Nov 23, 2020
@yoshi-automation yoshi-automation removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Nov 23, 2020
@munkhuushmgl
Copy link
Contributor

We do not officially support React, but I will reach out to someone about this issue.

@SomervilleTom
Copy link
Author

@munkhuushmgl: I appreciate your attention.

Perhaps your resources can identify some sort of work-around. It will be unfortunate if I'm unable to use googleapi at all, especially since I don't need or use the affected behavior (http2 support).

In the absence of a work-around, perhaps the googleapi documentation might be updated to more prominently mention that googleapi is not compatible with React.

@akshayravikumar
Copy link

akshayravikumar commented Dec 2, 2020

@SomervilleTom So I was able to fix my issue by making sure I don't import any of the googleapi code until runtime (so that it didn't happen during build or server-side rendering), and the errors went away. Basically that means removing it from any of the getProps implementations

@barancev
Copy link

I continue using googleapis v.48.0.0 that does not have this issue (I use it in the frontend of a Vue serverless application). Any attempt to upgrade to a newer version ends with "This dependency was not found: http2 in ./node_modules/googleapis-common/build/src/http2.js" error.

@b-loved-dreamer b-loved-dreamer self-assigned this Feb 23, 2021
@b-loved-dreamer
Copy link
Contributor

Hi. This issue relates to client-side support of googleapis services. This topic was discussed here. I am now closing this issue. Please, reopen if needed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: dialogflow Issues related to the googleapis/nodejs-dialogflow API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

7 participants