Nanoflow error: undefined is not an object

Hey guys I am super stuck. I keep running into this error when trying to update (MxObject.set) an mendix object that is passed to a Javascript Action as a parameter, and I’m not entirely sure why it’s happening. It’s passing checks I’ve put into place checking to see if it’s undefined, but it’s still throwing this ‘undefined’ error. I’m kinda new to some of the deeper intricacies of javascript and especially javascript within Mendix, so any help will be welcomed. Some additional information: - I am using a log action before hand to check and see that the object I’m passing in to the action isn’t empty, and it isn’t empty. - Mendix version is actually 8.4.1 (I didn’t see that as an option in the drop down. Also, ‘Javascript Action’ wasn’t an option in the Category drop down :/) - I am at my wits end Here is the error:   An error occurred while executing On click at NativeMobile.Home_Native.actionButton1: undefined is not an object (evaluating 'u.set("friendlyError",t.stack).set') Oe@ s@ P@ f@ y@ C@ callImmediates@ callImmediates@[native code] Here is the code causing the problem:   console.log(authObj.get("client_id")); if (authObj !== undefined) { authObj.set("friendlyError", error.stack) .set("errorMessage", error.message); } else { ; } return authObj; ^ This isn’t the entirety of the code, just a snippet, but I believe this is the section throwing the issue. If you wanna see the rest, please let me know.
1 answers

To check for undefined in javascript use

if ( typeof authObj != 'undefined' )

Also, It is not possible to chain multiple set commands:

authObj.set("friendlyError", error.stack)
.set("errorMessage", error.message); // throws error because set function returns undefined


authObj.set("friendlyError", error.stack)
authObj.set("errorMessage", error.message);