Flow context [object Object] while it exists?

I am confused, flow context says:


But injecting flow.browser produces:

It works, so that is great, but why is the context tab not parsing it ?

Odd - can you pass it to a function node with:

node.warn(typeof msg.browser) // or which ever is the object from context

It says it is an object

I cannot reproduce it from an inject node.

It only happens from the producing node (webdriver). When I set/move it to msg payload and then to a flow var, it also becomes [object Object] in the context. Very strange. Are there any reserved keywords ?

Something more fishy:

Set inject node to msg.payload = flow.browser and a debug node to only display msg.payload: [object Object]
Set debug node to complete msg object, it displays payload (correctly) as an object.

This will be related to the type of object the webdriver node is producing which is tripping up our encoding logic when the runtime is wrapping it up to pass to the editor. It isn't a true reflection of the what is actually stored.

There are subtly different code paths around rendering the top level object (msg) and rendering properties (msg.payload) which is why you get different results.

Without digging into the code, I can't be more specific at the moment. If you wanted to raise an issue that would be helpful.

I could also raise the question first at the node creator.

I don't think they are doing anything unreasonable.

JavaScript has lots of different subtly ways of dressing up objects. We ought to be able to handle them more generally, rather than having to make special cases. I thought we had got there, but this appears to be another edge case to deal with.

Ok thanks, I have raised issue 4098

I'm not sure if this is the right answer (I'm not a pro in this area)

but you can check if there is a defined constructor, and unwrap it if so

Check if the constructor name is Function not if its undefined (as I do in the screenshot) ::

I was wrong, nothing to see here. :sweat_smile:

Same happend to me in my custom nodes. When creating an object via a constructor, it would appear in the debug window as [object object].
Then I moved to creating the object via a function, and it shows properly.

function someNewObj(val1, val2)  {
   return {prop1:val1, prop2:val2};