First, my apologies for asking a multi-part question. As relayed in another user's post but not answered, in the manifest.xml file for PPRO 12.x developing panels, the <RequiredRuntime Name="CSXS" Version="x" works for me at Version 7.0 not 8.0 as per the Cookbook example. Will it change soon and what will be the effects, or is it no big deal?
Related, the current nodejs implementation in the PPRO environment is 7.7.4. Will that change to the V8 nodejs engine?
The ultimate reason for asking is that I am writing some nodejs on the js side of js/jsx code on a Mac PPRO 12.1, to access google-cloud speech. I have successfully accessed google-cloud/storage in nodejs - pretty easy actually, but I have encountered errors when accessing speech. After figuring out how to access the 'require' global - cep_node.require('..'); and working through issues in building the google required node_modules - building them with node v8 through the latest v10 (I guess using NODE_MODULE > 51) results in a grpc sub-dir being created being node-v64-darwin-x64-unknown. The error I get is that it wants sub-dir node-v51... which can be created (and error eliminated) if you build with node <v7.10 ie 7.7.4.
However, I am getting an error (and some unexpected behavior) The code (direct-ish) from the google-cloud/speech examples:
After building npm install --save @google-cloud/speech in the correct dir as per examples using node 7.7.4 and --enable-nodejs & --mixed-content in the manifest.xml.
(pretty standard example on google-cloud/speech)
function test(file_name){
const speech = cep_node.require('absolute/path/to/@google-cloud/speech');
const fs = cep_node.requre('fs');
const content = fs.readFileSync(file_name).toString('base64);
const client = new speech.SpeechClient({ projectId: pId, keyFilename : keyPath,});
const config = {config_object}; const audio = {content : content};
const request = {config: config, audio : audio};
client
.recognize (request)
.then (data => {do something}) // similar and also tried .then (function(data){do something})
.catch (err => { do some error thing});
}
Note: I execute similar code to access google-cloud/storage - no problem. Also, this is 'esversion:6' type of scripting, but it works.
All the values and variables are what I expect, up until the client.recognize(request) is probably? executed, but then no .then is executed ie no response from the google server. (I know its async)
The error/warning comes pre client:
internal/process/warning.js:21(node:42969) DeprecationWarning: grpc.load: Use the @grpc/proto-loader module with grpc.loadPackageDefinition instead
Then upon completion of the function:
Navigated to file:///Library/Application%20Support/Adobe/CEP/extensions/com.iv.PProPanel/index.html
ie. the page/panel is auto - reloaded for some reason.
I believe this is somehow related to the async nature of nodejs. The above warning may trigger the reload of the html page/panel, but I'm not sure. This won't happen if I comment-out the client section, ie acts as expected and the page is not auto-reloaded. Since the .recognize(request) function is async, and the page is auto reloaded (for a reason unknown to me), I am not able to see if the .then promise is resolved.
My thoughts are that the node v7.7.4 build node_modules are some older nodes than what google-cloud/speech wants. But building with a more recent (or current) node v, results in the first mentioned error. (can't find a needed dir) Possibly CEP V8 will use Chrome's V8 node engine then I can rebuild google-cloud/speech nodes to a more current state? Since i have been only dealing with nodejs for about 2 weeks and CEP for 3 weeks, I could be completely wrong in this approach.
Any insight or an explanation of why a panel would auto-reload, would be greatly appreciated.