-
Notifications
You must be signed in to change notification settings - Fork 608
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
value object of reqOpts object does not have hasOwnProperty method #2070
Comments
This is interesting, and the same issue as #2050. We (tried to) fix that by adding |
Just installing Something like this should work, though: npm install @google-cloud/common
rm -fr ./node_modules/google-cloud/node_modules/@google-cloud/common I can confirm that it fixes the problem. Is there a workaround in the mean time that doesn't require deleting files? |
'google-cloud' is just a bundled package that includes all of the service APIs. So you can install just '@google-cloud/storage' and use it directly until the 'google-cloud' package is updated. Sorry you ran into this. I will try to put out a new release today. |
I am running in to this issue since yesterday. The code is in cloud functions trying to access cloud storage using "@google-cloud/storage": "1.1.0" . Error: Sorry, we cannot connect to Cloud Services without a project ID. You may specify one with an environment variable named "GCLOUD_PROJECT". See https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/authentication for a detailed guide on creating an authenticated connection. The same cloud function also connects to datastore, which works without hitting this issue. |
@abdulj are you running a specific method in the Storage API when you see the error? |
@stephenplusplus I tried the below written two ways , both leading to this error. var file = bucket.file(name);
file.save(content,options, (err) => {
//custom code here
}); var file = bucket.file(name);
str.pipe(file.createWriteStream(options))
.on ('error',function(err) {
// custom code removed
})
.on('finish',function() {
// custom code removed
}); |
@abdulj I've been trying and failing to reproduce. Could you try this isolated example and see that it still occurs? https://gist.github.com/stephenplusplus/adf3b2bf3a6df17d3178def4a31aba6c |
@stephenplusplus thanks for the quick responses :) and sorry that I did not debug enough before commenting here. |
I'm glad it worked out! We have an issue to address the confusing error here: #2069 -- sorry for that :( |
v0.48.0 of google-cloud package is resulting in an error when attempting to upload a file.
The following code is enough to reproduce the issue.
The error itself is misleading (see #2069):
The real error originates here:
if (is.object(value) && is.fn(value.hasOwnProperty)) { for (var opt in value) { + if (value.hasOwnProperty(opt)) { value[opt] = replaceProjectIdToken(value[opt], projectId); } } }
The
value
Object does not havehasOwnProperty
method.The
reqOpts
object looks like this:Not very useful, but confirms that the former code sample is creating the error.
For whatever reason (I didn't dig that deep), the object contained in the
value
property does not havehasOwnProperty
method. In case relevant, Node.js v7.7.1.The text was updated successfully, but these errors were encountered: