Google Cloud TypeError: Cannot read property 'Reader' of undefined - google-cloud-platform

My Google Cloud Function won't upload if I include this line, which came from the docs:
const {Translate} = require('#google-cloud/translate').v2;
The error is
TypeError: Cannot read property 'Reader' of undefined
There's no Reader in my code.
My version is:
npm -v #google-cloud/translate
6.14.10
Which is odd, because the current npm version is 6.0.5, and the release notes say there hasn't been an update since March 2020.
I tried both Node 10 and Node 12 for the Firebase Cloud Functions engine, same error.
Am I getting this error because I'm on the event horizon of a black hole and downloaded a future version of #google-cloud/translate? I think I might be in an alternative universe, 2020 was awful. How are things in your universe?

I updated the npm modules in my /functions directory and the error message is gone. Both firebase-functions and #google-cloud/translate were out of date.

Related

BigQuery Client using Python | Timeout and Polling issues

I am trying to execute a SQL statement on BQ Database by initializing the BQ Client. This has been running smoothly for a while but lately seeing an issue.
My code specifically fails when its trying to wait for the results from the DB
query_job = client.query(QUERY) # API request to start the query
db_rslt = query_job.result() # Wait for the query to return results
Here is error message:
File "/opt/conda/default/lib/python3.7/site-packages/google/cloud/bigquery/job.py", line xxx, in result super(QueryJob, self).result(retry=retry, timeout=timeout) File "/opt/conda/default/lib/python3.7/site-packages/google/cloud/bigquery/job.py", line xxx, in result return super(_AsyncJob, self).result(timeout=timeout) File "/opt/conda/default/lib/python3.7/site-packages/google/api_core/future/polling.py", line xxx, in result self._blocking_poll(timeout=timeout, retry=retry, polling=polling) TypeError: _blocking_poll() got an unexpected keyword argument 'retry'
Added the timeout parameter to the result method but did not help
It depends on the version of your installed google-cloud-bigquery library, if you are using a 1.x version, make sure to set google-api-core to a version less than 1.34.0.
What is actually happening here is that when you install google-cloud-bigquery, a bunch of other google related libraries are installed automatically with it, google-api-core is one of these libraries. However, a higher version is being installed thus causing this problem.
In my case, setting my google-api-core==1.33.2 solves the issue. Other solution would be is to upgrade google-cloud-bigquery to a later version .
7 days ago Google released an update to google-api-core==1.34.0 for bug fixes. I guess this introduced some breaking changes if you are not using the later versions of google-cloud-bigquery. You may either:
Pin google-api-core to the previous working version (eg. 1.33.2)
Upgrade google-cloud-bigquery to the latest versions.
I solved it by changing the bigquery version to the latest: 'google-cloud-bigquery==3.4.0'.
This also happened to me.
My python image is 3.8.13:bulleye.
It was using the following stack of google library.
google-auth==1.33.0
google-cloud-bigquery==1.25.0
google-cloud-firestore==2.3.1
Changing them to
db-dtypes==1.0.0
google-auth==2.6.0
google-cloud-bigquery==3.0.1
google-cloud-firestore==2.5.3
solved the problems.
db-dtypes is required for new version of google cloud library.
This did the trick for me, although I was having this issue on Kaggle notebooks:
pip install -U google-cloud-bigquery google-api-core==1.33.2
Also the v2 version of google-api-core seems to work:
google-api-core==2.11.0
https://github.com/googleapis/python-api-core/releaseshttps://github.com/googleapis/python-api-core/releases

New Ember project: The "data" argument must be of type string or an instance

I used the cli to create a new Ember project (v2.18). I'm getting the following error when I try to build/serve the project. This is with 100% clean project, no edits yet. Also fwiw, am using node v14.19.3, npm v6.14.17.
- stack: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
at Object.writeFileSync (fs.js:1522:5)
at module.exports (/Users/nikoleizinsli/IdeaProjects/custom-fields-admin/node_modules/ember-cli/lib/utilities/attempt-never-index.js:26:6)
at Builder.build (/Users/nikoleizinsli/IdeaProjects/custom-fields-admin/node_modules/ember-cli/lib/models/builder.js:156:5)
at BuildTask.run (/Users/nikoleizinsli/IdeaProjects/custom-fields-admin/node_modules/ember-cli/lib/tasks/build.js:29:20)
at /Users/nikoleizinsli/IdeaProjects/custom-fields-admin/node_modules/ember-cli/lib/models/command.js:243:46
at tryCatcher (/Users/nikoleizinsli/IdeaProjects/custom-fields-admin/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:326:21)
at invokeCallback (/Users/nikoleizinsli/IdeaProjects/custom-fields-admin/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:498:33)
at /Users/nikoleizinsli/IdeaProjects/custom-fields-admin/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:562:16
at flush (/Users/nikoleizinsli/IdeaProjects/custom-fields-admin/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:2441:7)
at processTicksAndRejections (internal/process/task_queues.js:77:11)
UPDATE: I was able to get it to build by using Node v13. We have another Ember 2.18 project that compiles fine on Node v14...so not sure what is causing this.
Any reason you're using that version of Ember? It stopped getting updates in 2018. I'd guess this is an issue with Node 14, you may need to go back to Node 10 to get support for ember-cli 2.18. Or, even better, run npm install -g ember-cli to get the 4.4 version which supports Node 14+.

gcloud stop working - "was unexpected at this time."

I just update my google cloud SDK on windows 10 (gcloud components update).
After the update the gcloud command stop working.
All I get is (for example : gcloud -h):
PATH\lib\gcloud.py" -h" was unexpected at this time.
I try to re-install but it didn't help:(
As noted in the other answers, this is a bug with the 274.0.0 version of gcloud. Another report of this issue actually identifies where the bug is and offers this fix:
If you are stuck and need an immediate solution, here's a workaround that will move you forward, but you should reinstall the Cloud SDK from scratch when a fix is ready.
Open C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk-bin\gcloud.cmd in your editor
Near line 170, change ) ELSE ( to be just )
Remove the ) on the last line in the file.
That should get you working in the short term (albeit with an extraneous error message every time you run a command). After getting it working you can revert to version 273.0.0 (so that you stop getting the error message and aren't using a modified version) using:
gcloud components update --version=273.0.0
This is being tracked in the public bug https://issuetracker.google.com/issues/146458519
We have a patch for two files that are causing these problems. These apply in two cases (both on Windows):
1. A new install fails, or
2. You are unable to run gcloud after performing a components update.
For case # 1, please download the attached file install.bat, and copy it to the location where you have attempted to install gcloud, e.g. C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk. Then run it, e.g.
cd C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk
.\install.bat
For both cases #1 and #2, download the attached file gcloud.cmd, and copy it to the bin directory under your gcloud installation, e.g.
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin. When prompted to replace the previous copy, type Yes. This should allow you to run gcloud without being prompted to set CLOUDSDK_PYTHON.
The files are attached in the public bug tracker.
This is a known issue that is being tracked here
After hours of trying to fix it! I found how :)
uninstall google SDK
https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.zip
https://cloud.google.com/sdk/docs/downloads-interactive#interactive_installation
This fix the bug.
After that I had new bug in pyCharm GAE:
ImportError: No module named _subprocess
I fix this with the solution here:
Error importing built-in module "_subprocess" using Google Cloud Platform's Local Development Server
Hope this helps and saves a lot of trouble for you guys :)
I solved this problem. I got the same error message.
My Env: gcloud v274.0.0, Windows 7
First, I re-installed Google SDK, and changed my path to \Google\CloudSDK\.
Second, I got this message
"\Google\CloudSDK\google-cloud-sdk\bin..\lib\gcloud.py" init" was unexpected at this time."
So I tried to use cd command to specific directory where gcloud.py is exist.
Finally, I found the path: \Google\CloudSDK\google-cloud-sdk\lib, and it works.
Hope it can help you, too.
The problem, or rather bug within the installer, is that you are using a directory that contains spaces within it. At some point of the script the space causes the command to be split up incorrectly, causing the error.
I had the same message and fixed it by re-installing the Google Cloud SDK in a directory without spaces (c:\Google\CloudSDK)

Angular build error in core/src/render3/interfaces

While building an Angular 6 app i get a compile error in #angular/core/src/render3/interfaces on line 35. The line is:
[ACTIVE_INDEX]: number | null;
and the error is:
error TS1169: A computed property name in an interface must directly refer to a built-in symbol.
I an using #angular/core#6.1.6. Am I doing something wrong or is this an Angular bug?
Verify that Visual Studio is targeting the correct version of Typescript (as seen in your package.json), then try deleting your node_modules folder, and rerunning npm install.
I believe that this is caused by running Angular 6 with an earlier, incompatible version of typescript (<2.7), because it looks like the ability used by the container.d.ts file (referenced in your error) to use Constant-Named Properties was added in Typescript 2.7. Of course, if it were that simple then ng serve would tell you about the Typescript incompatibility, so I assume that I'm either wrong, or that your environment is playing tricks on you.
See here for a related question.

Sulu not running on PHP7

was any one of you able to install sulu on a webserver running Apache and PHP7?
When I try to clear the cache, I get an error PHP Fatal error: Cannot use 'String' as class name as it is reserved in /var/www/foobar/vendor/doctrine/phpcr-odm/lib/Doctrine/ODM/PHPCR/Mapping/Annotations/String.php on line 28
We are already working on that. The main problem is the usage of a class named String in the PHPCR-ODM. They fixed that in version 1.3. Also there are some tests still failing, but we are already working on that. You can follow the progress on the corresponding PR.