Forms Router Exists bug

When using a Form Router to check {{context.user.app_metadata.status}}, with the user.app_metadata set as the default { }, “exists” incorrectly returns true.

When using “has value”, this correctly returns false.

Hi @jarren.ong

The has value is the right operator to use when checking for the presence of data inside app_metadata .

The “exists” operator is returning true because it is performing a structural definition check, rather than a strict data check. Because the parent object (app_metadata ) is explicitly initialized as an empty object {} , the router considers the object path to “exist,” even if the specific leaf property (status ) is undefined.

→ When the router evaluates {{context.user.app_metadata.status}} using “exists”, it checks if the reference is structurally valid within the context. Because Auth0 initializes app_metadata as {} by default, the app_metadata object technically exists. The engine sees that the parent object is present and, rather than throwing an undefined error for status , it loosely evaluates the path’s existence as true .

→ When you switch to “has value”, the router performs a much stricter evaluation on the final leaf node (status ). It checks if the actual result of the expression is populated (i.e., not undefined , not null , and not an empty string "" ). Because status does not have a value inside the {} object, it correctly returns false .

When evaluating nested JSON properties like app_metadata or user_metadata in Auth0 Forms, you should default to using “has value” to determine if a property has been populated.

Kind Regards,
Nik

Hi Nik,

I understand but if that’s the case maybe the “exists” operator should be updated to check for the nested property or object. I can see other users potentially expecting the same result as me and objectively, the status property does not exist in this scenario.

ie how does this make sense for an operator named “exists”

Because the parent object (app_metadata ) is explicitly initialized as an empty object {} , the router considers the object path to “exist,” even if the specific leaf property (status ) is undefined

Warm regards,

Jarren