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

Build failing on Windows #327

Closed
elierotenberg opened this issue Sep 29, 2020 · 1 comment
Closed

Build failing on Windows #327

elierotenberg opened this issue Sep 29, 2020 · 1 comment
Assignees
Labels
type: docs Improvement to the documentation for an API.

Comments

@elierotenberg
Copy link
Contributor

elierotenberg commented Sep 29, 2020

I wanted to contribute a patch to the library, and tried to follow the CONTRIBUTING setup instructions.

I am running a Windows / Git Bash setup.

npm test and npm samples-test runs without problems (however samples-test is empty).

When running npm system-test, I came across the following problems:

Authentication-related problems

Authenticating with GCP

Using gcloud auth application-default login as per the instructions, I got the following error:

Your application has authenticated using end user credentials from the Google Cloud SDK
or Google Cloud Shell which are not supported by the translate.googleapis.com.
We recommend configuring the billing/quota_project setting in gcloud or using a service account
through the auth/impersonate_service_account setting.
For more information about service accounts and how to use them in your application,
see https://cloud.google.com/docs/authentication/.

To solve this, I had to manually create an application credentials file, and use export GOOGLE_APPLICATION_CREDENTIALS="...".

Using the Cloud Translation API

After authenticating as above, I got the following error in it should send data in a POST:

Cloud Translation API has not been used in project XXXXXXX before or it is disabled. Enable it by visiting
https://console.developers.google.com/apis/api/translate.googleapis.com/overview?project=XXXXXXX
then retry.
If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.'

To solve this I had to manually enable the Cloud Translation API on my project.

Using the Google Storage API

After authenticating as above, I got the following error in should handle multi-part uploads:

{
  error: {
    code: 404,
    message: 'Not Found',
    errors: [ { message: 'Not Found', domain: 'global', reason: 'notFound' } ]
  }
}

I noticed the code referenced https://storage.googleapis.com/storage/v1/b/${projectId}/o so I had to manually create a storage bucket with the same name as my project id.

Webpack-related problems

Webpack config for the systems test didn't exclude tls, net and http2. I had to add them.

After that, I still got the following error during build:

ERROR in ./node_modules/googleapis-common/build/src/http2.js
Module not found: Error: Can't resolve 'http2' in 'C:\(REDACTED)\node_modules\googleapis-common\build\src'
 @ ./node_modules/googleapis-common/build/src/http2.js 16:14-30
 @ ./node_modules/googleapis-common/build/src/apirequest.js
 @ ./node_modules/googleapis-common/build/src/index.js
 @ ./src/index.ts

I guess it was due to backslash-delimited path in the exclusion rules to I transformed each like

test: /src\/http2/

to

test: /src(\/|\\)http2/

I'm not sure this is the cleanest way to achieve that but it finally worked.

I am proposing a PR including the webpack-related fixes.

However the authentication-related fixes don't imply any code change. Maybe we should update the CONTRIBUTING docs instead?

Environment details

  • OS: Windows 10
  • Node.js version: 12.18.0
  • npm version: 6.14.4
  • googleapis-common version: 4.4.0

Steps to reproduce

  1. Checkout the repo under Windows
  2. Run npm run system-test
elierotenberg added a commit to elierotenberg/nodejs-googleapis-common that referenced this issue Sep 29, 2020
* Properly add `tls`, `net` and `http2` node modules to the exclusion
  list for the `system-test` webpack build.

* Replace hard-coded slashes (`/`) with either slashes or backslashes
  in the module exclusion rules for the `system-test` webpack build.

Partially addresses googleapis#327.
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Sep 30, 2020
@sofisl sofisl added the type: docs Improvement to the documentation for an API. label Sep 30, 2020
@yoshi-automation yoshi-automation removed the triage me I really want to be triaged. label Sep 30, 2020
@sofisl
Copy link
Contributor

sofisl commented Dec 7, 2020

Added instructions to our system tests in: googleapis/synthtool#872

@sofisl sofisl closed this as completed Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: docs Improvement to the documentation for an API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants