Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use module in Ionic4 + Angular8 + Firebase apps #566

Closed
merkledag opened this issue Aug 26, 2019 · 4 comments
Closed

Cannot use module in Ionic4 + Angular8 + Firebase apps #566

merkledag opened this issue Aug 26, 2019 · 4 comments
Assignees
Labels
api: logging Issues related to the googleapis/nodejs-logging API. browser type: question Request for information or clarification. Not an issue. web

Comments

@merkledag
Copy link

Environment details

  • OS: Ubuntu 16.04
  • Node.js version: 11.10.0
  • npm version: 6.7.0
  • @google-cloud/logging version: 5.2.2
  • AngularCLI: 8.2.3
  • typescript: 3.5.3
  • webpack 4.39.2

Steps to reproduce

Objective use nodejs-logging in an Ionic4+Angular8+Firebase app to write logs to StackDriver
In the app root:

  1. npm install @google-cloud/logging
  2. Go to @google-cloud/logging/build/proto/logging.d.ts, and add this import statement
    import {Long} from "protobufjs";
  3. Do the same in @google-cloud/logging/build/proto/logging.config.d.ts
  4. Build the Ionic app

Get a list of Module not found errors for various node core modules such as crypto, child_process, fs, zlib, http, tls, os etc. e.g.

ERROR in ./node_modules/google-gax/build/src/operationsClientBrowser.js
Module not found: Error: Can't resolve './operations_client_config' in '/home/pam/strata1/strata_forms_app/node_modules/google-gax/build/src'
ERROR in ./node_modules/@google-cloud/common/node_modules/google-auth-library/build/src/auth/googleauth.js

Does this mean that @google-cloud/logging cannot be used in Angular-Firebase apps?

Thanks!

@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Aug 27, 2019
@bcoe bcoe added type: question Request for information or clarification. Not an issue. browser and removed triage me I really want to be triaged. labels Aug 27, 2019
@alexander-fenster
Copy link
Contributor

Hi @merkledag,

We are in progress of making it possible to use the libraries with Webpack but it will likely take some more time. The reason for that is that this library uses gRPC (sends protocol buffers over HTTP/2) which cannot be webpacked easily. While that work is in progress, you can try using our less complicated library https://github.com/googleapis/google-api-nodejs-client/tree/master/src/apis/logging (which sends plain JSON over HTTP/1 and thus is webpackable). Alternatively, take care of your logging calls on the server side.

We'll update this issue when the webpack work is complete.

Thank you for reporting this issue!

@merkledag
Copy link
Author

Thanks for the info, Alexander. Good to know.

@google-cloud-label-sync google-cloud-label-sync bot added the api: logging Issues related to the googleapis/nodejs-logging API. label Jan 31, 2020
@Yahya-khodr
Copy link

Hi @alexander-fenster
Is this issue still under development ?
or it is already done and resolved ?
can we now use the cloud logging in Angular + firebase app ?

@alexander-fenster
Copy link
Contributor

Hi @Yahya-khodr,

We don't officially support any kind of browser use case.

Having that said, the library should work with webpack v4 (not v5) if you follow the tweaks we do in our webpack.config.js and then authenticate as described in googleapis/google-cloud-node#2933 (comment). Just as I said - should work, but not yet production ready, and might require some time to setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/nodejs-logging API. browser type: question Request for information or clarification. Not an issue. web
Projects
None yet
Development

No branches or pull requests

6 participants