VM41:1 Uncaught SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse ()
at sessionManager.js:28
at Array.reduce ()
at n.getData (sessionManager.js:26)
at n.render (sessionManager.js:22)
at n.constructor (BaseComponent.js:20)
at n (appConnect.js:490)
at n.e.hasOwnProperty.e.constructor (appConnect.js:523)
at new n (appConnect.js:490)
at n.$addChild (BaseComponent.js:213)
VM41:1 Uncaught SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at sessionManager.js:28
at Array.reduce (<anonymous>)
at n.getData (sessionManager.js:26)
at n.render (sessionManager.js:22)
at n.constructor (BaseComponent.js:20)
at n (appConnect.js:490)
at n.e.hasOwnProperty.e.constructor (appConnect.js:523)
at new n (appConnect.js:490)
at n.$addChild (BaseComponent.js:213)
Can you please paste your whole flow code and how do you call it?
Also make sure to follow the rules for pasting code in your post to make them more easily readable: How to format code in your posts
That’s a problem in your logic.
Your server connect does not run on page load, then you run a flow which runs the server action, and also runs a set session step.
All the steps executed using the “Run” steps are executed asynchronously, and they don’t wait for the previous one to complete. So in your case the server action runs, but also set session runs at the same time.
When the set session step runs the data from userdetail.data.query1[0].email is not yet available as the server action has not finished loading, so the value set for the session is undefined:
You don’t really need to use a flow for that.
Just use the dynamic events of the button to run the server action on click and then onsuccess of the server action set the session.