-
Notifications
You must be signed in to change notification settings - Fork 139
ImageAnnotatorClient does not work inside Electron.js #573
Comments
I can fix this by changing this line in image_annotator_client.ts: from I hope there is a good way to handle this, especially in the situation when people use Electron.js (having both browser and node.js) |
Hey @phdggg, Could you please specify more details. Nodejs version, electron version and also if you could provide your complete code. Thanks. |
This should be working without any special changes to the client; just make sure you update your dependencies ( Alternatively, as discussed in googleapis/nodejs-speech#547, just use the bundler ( You will need to authenticate as described here (with OAuth2) or possibly with an API key, as shown in the aforementioned nodejs-speech issue. |
@alexander-fenster I also have this issue. Can you give more details on using the bundler? how do we do that? I tried [email protected] /Users/tim/Projects/komika Maybe this is the problem.... I show isBrowser is true, but the condition is !isBrowser && fallback to go to the fallback gax If it is browser, than fallback is true, so the condition will always be false and it can never get to the fallback. I think gaxModule should be set with this:
|
Here's an awful workaround: const client = new vision.ImageAnnotatorClient({
get fallback() {
return false
},
set fallback(_) {}
}); This forcefully prevents the fallback property from being changed. |
Hi, I am able to use ImageAnnotatorClient to call google vision API for no problem.
But when I tried to run the same code inside Electron.js.
const client = new vision.ImageAnnotatorClient({
keyFilename: "key.json"
});
The following error occurs:
Uncaught (in promise) TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object
at validateString (internal/validators.js:112)
at Object.basename (path.js:1157)
at GrpcClient.loadProto (grpc.ts:166)
at new ImageAnnotatorClient (image_annotator_client.ts:144)
at myfunction (/Users/XXX/Demo/mycode.js:40)
at FSReqCallback.oncomplete (fs.js:146)
It seems that the error occurred in the following code snippet inside image_annotator_client.ts
The text was updated successfully, but these errors were encountered: