ResolveError in script node on using console.log(context);

Why do I keep get this ResolveError in script node even if there is only one line code which tries to log info in the script node?
Error: {“statusCode”:400,“status”:400,“customCode”:“ResolveError”,“errors”:[{“msg”:"{“errors”:…
Code: console.log(context);

@aojwen
Please do not attempt to console.log. It will not work.
For your troubleshooting please use koreDebugger.log(' < debug statement> '); insside a script node.

I am getting same error even though I have not console.log() in the script

Hi @dev_habeeb ,

Are you able to execute the same script outside the platform/bot builder?

Could you please help us validate the request that you are initiating via script i.e. Syntax, etc?

Kindly use koreDebugger.log('debug statement'); inside a script node to get more details on the issue.

Regards,
Kore.ai Community Team.

this is the content of the my script node… i am still getting the same error

var fcnumber = {{context.entities.FCNumber}};
const regex = /^[A-Za-z]{3}[0-9]{3}$/;
koreDebugger.log(regex.test(fcnumber));
UserSession.put(“fcnumbervalidationflag”) = regex.test(fcnumber);

I even replaced the code with simple one line JS code like
var a = 5;
I tried creating another script , another dialog task, another task , tried in another browser also.
still I am getting the same error.

I have seen this problem before and it’s hard to diagnose based on the error messages in the debugger.
Here’s the test script I built to find the solution:

var fcnumber = context.entities.FCNumber;
const pattern = /^[A-Za-z]{3}[0-9]{3}$/;
koreDebugger.log(fcnumber);
var validationFlag = pattern.test(fcnumber);
koreDebugger.log(validationFlag);
koreDebugger.log(pattern.test(fcnumber));
UserSession.put(“fcnumbervalidationflag”, pattern.test(fcnumber));

First, you don’t use double curly brackets in a script node.
image

Second, you must use the correct syntax for the “PUT” statement.
image

Finally, you must use the correct quotation marks. This one is crazy, but somehow the wrong style of quote will cause an error. This usually happens during a cut / paste from a text document.

image

Just delete the quotes and re-enter using the script editor…fixes it every time!

That was a tough one…hope this helps!