google-api-nodejs-client icon indicating copy to clipboard operation
google-api-nodejs-client copied to clipboard

Use with React and Browser apps and chrome extensions

Open jmc420 opened this issue 4 years ago • 7 comments

Please could it make clear in the documentation whether this api can be used with React in a Browser in a standard webapp or Chrome extensions?

There is this bug report which appears to indicate that it can be used:

https://github.com/googleapis/google-api-nodejs-client/issues/1614

There is the alternative google-api-javascript-client library but it is not published in the npm registry and it doesn't look that it is possible to do this:

https://github.com/google/google-api-javascript-client/issues/432

jmc420 avatar Dec 18 '20 16:12 jmc420

When trying to build google-api-nodejs-client/src/apis/calendar this webpack error came up.

[webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.                              
configuration.node should be one of these:  
false | object { __dirname?, __filename?, global? }   
-> Include polyfills or mocks for various node stuff.                                                                                                         
 Details:     
* configuration.node has an unknown property 'child_process'. These properties are valid:                                                                          object { __dirname?, __filename?, global? } 
-> Options object for node compatibility features.     * configuration.node has an unknown property 'fs'. These properties are valid:                                                                                     
 object { __dirname?, __filename?, global? }         -> Options object for node compatibility features.                                                                                                              
 * configuration.node has an unknown property 'crypto'. These properties are valid:                                                                                 
object { __dirname?, __filename?, global? }
 -> Options object for node compatibility features.    
* configuration.node has an unknown property 'http2'. These properties are valid:                                                                                  
 object { __dirname?, __filename?, global? }                                                                                              
-> Options object for node compatibility features. 

Automatic NodeJs polyfills were removed in webpack 5

https://webpack.js.org/blog/2020-10-10-webpack-5-release/#automatic-nodejs-polyfills-removed

It's possible to manually add a polyfill for a Node.js core module. An error message will give a hint on how to achieve that.

Perhaps the solution is to provide the nodejs polyfills manually now?

marvinirwin avatar Dec 29 '20 18:12 marvinirwin

Any movement on this?

TadhgOCP avatar Oct 21 '22 10:10 TadhgOCP

I'm facing this issue too, some say this library is only used for nodejs (server), but it's just pointless since we all live in the web era. Any progress?

radityoardi avatar Oct 22 '22 08:10 radityoardi

+1 for this issue too. Is this library meant to be used in browser environment too?

I'm getting this error when trying to import {calendar} from '@googleapis/calendar' in a Vue component.

image

albertpratomo avatar Oct 04 '23 22:10 albertpratomo

@albertpratomo did you find any solutions to this?

vp5h avatar Dec 08 '23 14:12 vp5h

I'm having this issue right now, anyone find anything?

shaineoneal avatar Dec 31 '23 01:12 shaineoneal

I directly made API requests via fetch to get around this.

vp5h avatar Jan 02 '24 11:01 vp5h