RemObjectsSDK.js and generated js code cannot be used with strict mode

I’ve been trying to use the javascript client in combination with k6 for some testing but am getting numerous errors related to strict mode not being active.

Hi,

Can you specify what version of Remoting SDK are you using, pls?
What errors do you have?

RemotingSDK version 10.0.0.1559.

First error:

SyntaxError: Strict mode code may not include a with statement at file:///<path_to>/RemObjectsSDK.js:1764:1

Second error:

TypeError: Cannot convert undefined or null to object at file:///<path_to>/AppServerLibrary_intf.js:40:12(12)

Third error:

ReferenceError: __namespace is not defined at file:///<path_to>/AppServerLibrary_intf.js:26:0(7)

Another error:

TypeError: Value is not a constructor at file:///<path_to>/RemObjectsSDK.js:568:40(116)

I was trying to modify the code to work on this end but ran out of time.

Logged as bugs://D19394.

bugs://D19394 was closed as fixed.

I’m glad this issue was fixed!

Is there a way I could try it out?

Hi,

note: this fix will be in .1575

for now you can change code manually:

  • RemObjectsSDK.js. replace
with ({
  p: (BinaryParser.prototype.Buffer = function Buffer(bigEndian, buffer) {
    (this.bigEndian = bigEndian || 0), (this.buffer = []), this.setBuffer(buffer);
  }).prototype,
}) {

with

{
  const p = (BinaryParser.prototype.Buffer = function Buffer(bigEndian, buffer) {
    (this.bigEndian = bigEndian || 0), (this.buffer = []), this.setBuffer(buffer);
  }).prototype;
  p.readBits = function (start, length) {
...
  • autogenerated *_intf.js:
    add var before __namespace, like
var __namespace = this;

I can’t reproduce

you can drop your .RODL to support@ for investigation

I also had to change const RemObjects = require("./RemObjectsSDK").RemObjects; to const RemObjects = require("./RemObjectsSDK.js").RemObjects;

The error you could not reproduce was an error caused by my code here.

Hi,

thx, added.

Curious, pretty sure the “.js” is supposed to be optional, and not commonly typed out…

The k6 testing tool being used could not find the file until the .js was added.

1 Like