You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Scoping error in packages/common/src/util.js #1654
When Google Storage is used to access a file that does not exist, the following uncaught exception is generated by the package:
error: ApiError: Not Found
at new util.ApiError (/tmp/node_modules/google-cloud/node_modules/@google-cloud/common/src/util.js:107:10)
at Object.parseHttpRespMessage (/tmp/node_modules/google-cloud/node_modules/@google-cloud/common/src/util.js:149:33)
at Object.handleResp (/tmp/node_modules/google-cloud/node_modules/@google-cloud/common/src/util.js:124:18)
at .<anonymous> (/tmp/node_modules/google-cloud/node_modules/@google-cloud/storage/src/file.js:632:21)
at emitOne (events.js:96:13)
at emit (events.js:188:7)
at emitOne (events.js:96:13)
at DestroyableTransform.emit (events.js:188:7)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
Going to line 107 of the offending file shows this:
On capturing a stack trace at the offending line, it appears that the function above is invoked thrice. The first invocation works but the next two fail. The code that invokes the above function is as follows (line 149 of the same file):
function parseHttpRespMessage(httpRespMessage) {
var parsedHttpRespMessage = {
resp: httpRespMessage
};
if (httpRespMessage.statusCode < 200 || httpRespMessage.statusCode > 299) {
// Unknown error. Format according to ApiError standard.
parsedHttpRespMessage.err = new util.ApiError({ // this is line 149
errors: [],
code: httpRespMessage.statusCode,
message: httpRespMessage.statusMessage,
response: httpRespMessage
});
}
return parsedHttpRespMessage;
}
Sure. I was previously using [email protected] and hadn't noticed these issues. Moving to google-cloud (starting with 0.40.0 and now at 0.41.2) shows these issues.
The code is behaving as expected. The issue that caused the uce was due to passing the error object returned by this call to gcloud logging instead of error.stack. Here was the uce for reference - I will close this issue.
{ t: 'object',
x:
TypeError: obj.hasOwnProperty is not a function
at Function.GrpcService.objToStruct_ (/tmp/node_modules/google-cloud/node_modules/@google-cloud/common/src/grpc-service.js:669:13)
at Function.GrpcService.encodeValue_ (/tmp/node_modules/google-cloud/node_modules/@google-cloud/common/src/grpc-service.js:506:32)
at Function.GrpcService.objToStruct_ (/tmp/node_modules/google-cloud/node_modules/@google-cloud/common/src/grpc-service.js:676:50)
at Function.GrpcService.encodeValue_ (/tmp/node_modules/google-cloud/node_modules/@google-cloud/common/src/grpc-service.js:506:32)
at Function.GrpcService.objToStruct_ (/tmp/node_modules/google-cloud/node_modules/@google-cloud/common/src/grpc-service.js:676:50)
at Function.GrpcService.encodeValue_ (/tmp/node_modules/google-cloud/node_modules/@google-cloud/common/src/grpc-service.js:506:32)
at Function.GrpcService.objToStruct_ (/tmp/node_modules/google-cloud/node_modules/@google-cloud/common/src/grpc-service.js:676:50)
at Function.GrpcService.encodeValue_ (/tmp/node_modules/google-cloud/node_modules/@google-cloud/common/src/grpc-service.js:506:32)
at Function.GrpcService.objToStruct_ (/tmp/node_modules/google-cloud/node_modules/@google-cloud/common/src/grpc-service.js:676:50)
at Function.GrpcService.encodeValue_ (/tmp/node_modules/google-cloud/node_modules/@google-cloud/common/src/grpc-service.js:506:32),
e: '{}' }
Activity
abawany commentedon Sep 30, 2016
On capturing a stack trace at the offending line, it appears that the function above is invoked thrice. The first invocation works but the next two fail. The code that invokes the above function is as follows (line 149 of the same file):
stephenplusplus commentedon Sep 30, 2016
Can you show the code you're using that access our library?
abawany commentedon Sep 30, 2016
Sure. I was previously using
[email protected]and hadn't noticed these issues. Moving togoogle-cloud(starting with 0.40.0 and now at 0.41.2) shows these issues.stephenplusplus commentedon Sep 30, 2016
I haven't been able to reproduce with the following code using
@google-cloud/storage@0.2.0 (included ingoogle-cloud> 41.0):{ "name": "@google-cloud/gissue-1654", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "@google-cloud/storage": "^0.2.0" } }Would you mind trying it in this format, which doesn't have other dependencies?
abawany commentedon Sep 30, 2016
The code is behaving as expected. The issue that caused the uce was due to passing the error object returned by this call to gcloud logging instead of error.stack. Here was the uce for reference - I will close this issue.
stephenplusplus commentedon Sep 30, 2016
Phew, glad it worked out!
abawany commentedon Feb 1, 2021
@JustinBeckwith and @stephenplusplus not sure why this 4 year old bug was re-assigned to me but it is closed anyways so no harm no foul, I guess ?
fix: remove serializer check from Query.isEqual() (#1654)
fix: check generation on source files not metageneration on bucket (#…
chore: release 5.15.1 (#1655)
fix: Improve spanner.date handling of years before 1000AD (#1654)
chore(main): release 3.2.1 (#1654)
chore(deps): update dependency @bazel/bazelisk to ^1.26.0 (#1654)
fix: check generation on source files not metageneration on bucket (g…
chore: release 5.15.1 (googleapis#1655)
chore(main): release 3.2.1 (#1654)