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
to
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
- Checkout the repo under Windows
- Run
npm run system-test
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 testandnpm samples-testruns without problems (howeversamples-testis empty).When running
npm system-test, I came across the following problems:Authentication-related problems
Authenticating with GCP
Using
gcloud auth application-default loginas per the instructions, I got the following error: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: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:I noticed the code referenced
https://storage.googleapis.com/storage/v1/b/${projectId}/oso 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,netandhttp2. I had to add them.After that, I still got the following error during build:
I guess it was due to backslash-delimited path in the exclusion rules to I transformed each like
to
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
googleapis-commonversion: 4.4.0Steps to reproduce
npm run system-test