You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hop.apache.org by "Mattang-Dan (via GitHub)" <gi...@apache.org> on 2023/11/16 21:36:52 UTC

[I] [Bug]: Javascript transform has a 'Get variables' button that raises errors when it should not (hop)

Mattang-Dan opened a new issue, #3403:
URL: https://github.com/apache/hop/issues/3403

   ### Apache Hop version?
   
   2.7
   
   ### Java version?
   
   openjdk 11.0.19 2023-04-18 LTS OpenJDK Runtime Environment Microsoft-7621296 (build 11.0.19+7-LTS) OpenJDK 64-Bit Server VM Microsoft-7621296 (build 11.0.19+7-LTS, mixed mode)
   
   ### Operating system
   
   Windows
   
   ### What happened?
   
   The JavaScript button 'Get Variables' seems to be buggy.  Several times I changed the Javascript code below and re-run and it does not always work, and sometimes it does. The script below is valid, but when clicking 'Get variables" I get an error about the token which is a valid data row stream field that I am referencing.  I had to manually add the field 'flattened_json' to get it to work.
   
   **Error is:**
   HopException: 
   General error executing script:
   SyntaxError: Unexpected token: t (script#9)
   
   Root cause: EcmaError: SyntaxError: Unexpected token: t (script#9)
   
   
   ```
   //Script to flatten JSON keys for Hop
   
   //var input_json = {
   //    "c-102": "AIDS Healthcare",
   //    "c-105": "AIDS Healthcare Direct",
   //    "c-75": "Allied Physicians (ALIP)",
   //    "c-59": "Asheville Endocrinology"};
   
   var input_json = JSON.parse(tabsFlat);
   var output_json = [];
   
   for (var key in input_json) {
       var value = input_json[key];
       output_json.push({
           field1: key,
           field2: value
       });
   }
   
   var flattened_json = JSON.stringify(output_json);
   ```
   
   ### Issue Priority
   
   Priority: 3
   
   ### Issue Component
   
   Component: Hop Gui


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug]: Javascript transform has a 'Get variables' button that raises errors when it should not (hop)

Posted by "Mattang-Dan (via GitHub)" <gi...@apache.org>.
Mattang-Dan commented on issue #3403:
URL: https://github.com/apache/hop/issues/3403#issuecomment-1816624833

   Getting error running the following via the normal Hop process (not manually setting pipeline properties parameters) and get a new error:
   
   ```
   2023/11/16 13:11:56 - js: flatten JSON keys.0 - Optimization level set to 9.
   2023/11/16 13:11:56 - ji: tabsFlat.0 - Finished processing (I=1, O=0, R=1, W=1, U=0, E=0)
   org.apache.hop.core.exception.HopValueException: 
   Couldn't compile javascript: 
   missing } after property list (script#16)
   
   	at org.apache.hop.pipeline.transforms.javascript.ScriptValues.addValues(ScriptValues.java:305)
   	at org.apache.hop.pipeline.transforms.javascript.ScriptValues.processRow(ScriptValues.java:492)
   	at org.apache.hop.pipeline.transform.RunThread.run(RunThread.java:55)
   	at java.base/java.lang.Thread.run(Thread.java:829)
   Caused by: org.mozilla.javascript.EvaluatorException: missing } after property list (script#16)
   	at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:79)
   	at org.mozilla.javascript.DefaultErrorReporter.error(DefaultErrorReporter.java:66)
   	at org.mozilla.javascript.Parser.addError(Parser.java:258)
   	at org.mozilla.javascript.Parser.reportError(Parser.java:326)
   	at org.mozilla.javascript.Parser.reportError(Parser.java:320)
   	at org.mozilla.javascript.Parser.mustMatchToken(Parser.java:493)
   	at org.mozilla.javascript.Parser.mustMatchToken(Parser.java:483)
   	at org.mozilla.javascript.Parser.objectLiteral(Parser.java:3638)
   	at org.mozilla.javascript.Parser.primaryExpr(Parser.java:3108)
   	at org.mozilla.javascript.Parser.memberExpr(Parser.java:2732)
   	at org.mozilla.javascript.Parser.unaryExpr(Parser.java:2626)
   	at org.mozilla.javascript.Parser.mulExpr(Parser.java:2547)
   	at org.mozilla.javascript.Parser.addExpr(Parser.java:2531)
   	at org.mozilla.javascript.Parser.shiftExpr(Parser.java:2512)
   	at org.mozilla.javascript.Parser.relExpr(Parser.java:2487)
   	at org.mozilla.javascript.Parser.eqExpr(Parser.java:2459)
   	at org.mozilla.javascript.Parser.bitAndExpr(Parser.java:2448)
   	at org.mozilla.javascript.Parser.bitXorExpr(Parser.java:2437)
   	at org.mozilla.javascript.Parser.bitOrExpr(Parser.java:2426)
   	at org.mozilla.javascript.Parser.andExpr(Parser.java:2415)
   	at org.mozilla.javascript.Parser.orExpr(Parser.java:2404)
   ```
   
   ![image](https://github.com/apache/hop/assets/100213981/412bc837-3a39-4436-9360-aa61aaca9631)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug]: Javascript transform has a 'Get variables' button that raises errors when it should not (hop)

Posted by "Mattang-Dan (via GitHub)" <gi...@apache.org>.
Mattang-Dan commented on issue #3403:
URL: https://github.com/apache/hop/issues/3403#issuecomment-1816607960

   ![image](https://github.com/apache/hop/assets/100213981/e85927b3-42bf-48b4-8faf-10002b1cc29a)
   
   And when I run it without using the Preview function via setting Parameters in the pipeline properties manually, I receive this error:
   
   ```
   2023/11/16 13:11:56 - ji: tabsFlat.0 - Finished processing (I=1, O=0, R=1, W=1, U=0, E=0)
   org.apache.hop.core.exception.HopValueException: 
   Couldn't compile javascript: 
   missing } after property list (script#16)
   
   	at org.apache.hop.pipeline.transforms.javascript.ScriptValues.addValues(ScriptValues.java:305)
   	at org.apache.hop.pipeline.transforms.javascript.ScriptValues.processRow(ScriptValues.java:492)
   	at org.apache.hop.pipeline.transform.RunThread.run(RunThread.java:55)
   	at java.base/java.lang.Thread.run(Thread.java:829)
   Caused by: org.mozilla.javascript.EvaluatorException: missing } after property list (script#16)
   	at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:79)
   	at org.mozilla.javascript.DefaultErrorReporter.error(DefaultErrorReporter.java:66)
   	at org.mozilla.javascript.Parser.addError(Parser.java:258)
   	at org.mozilla.javascript.Parser.reportError(Parser.java:326)
   	at org.mozilla.javascript.Parser.reportError(Parser.java:320)
   	at org.mozilla.javascript.Parser.mustMatchToken(Parser.java:493)
   	at org.mozilla.javascript.Parser.mustMatchToken(Parser.java:483)
   	at org.mozilla.javascript.Parser.objectLiteral(Parser.java:3638)
   	at org.mozilla.javascript.Parser.primaryExpr(Parser.java:3108)
   	...
   ```
   	


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug]: Javascript transform has a 'Get variables' button that raises errors when it should not (hop)

Posted by "hansva (via GitHub)" <gi...@apache.org>.
hansva closed issue #3403: [Bug]: Javascript transform has a 'Get variables' button that raises errors when it should not
URL: https://github.com/apache/hop/issues/3403


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug]: Javascript transform has a 'Get variables' button that raises errors when it should not (hop)

Posted by "hansva (via GitHub)" <gi...@apache.org>.
hansva commented on issue #3403:
URL: https://github.com/apache/hop/issues/3403#issuecomment-5252858547

   .take-issue


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org