SyntaxError: Unexpected end of input when using RegExp in the Serverless app

the below snippet is working fine in the local environment, but it’s failing as a custom app. the same code working fine on old apps.

is there anything I am missing here?

String.prototype.replaceAll = function(search, replacement) {
  var target = this;
  return target.replace(new RegExp(search, "g"), replacement);
};

Got the following error:

Error while running the server code inside the sandboxExecutor. - server.js:125, SyntaxError: Unexpected end of input\n at new Script (vm.js:83:7)

1 Like

Team,

Found the problem, it was not because of RegExp, I had a comment at the end of the server.js file, which caused this issue.

Thanks,

3 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.