`$_ERROR` Not populating properly in server actions

I have a try/catch in my server action where I want to show the $_ERROR.
This variable seems to not populate properly anymore. It doesn’t show the value when I try to log $_ERROR.

Reproduce

  1. Create a try/catch
  2. Put a query in the try, don’t set up any settings inside query so it’ll fail
  3. Add a response step in teh catch where you add the $_ERROR to the ‘text’ property
    Should look like this:

Result: empty response CleanShot 2024-04-29 at 17.36.22

Now add a string next to the error:

It shows the full string and the actual error message: CleanShot 2024-04-29 at 17.37.07

This is very annoying as we’re using the logging extension from @tbvgl
We have MANY server actions where we’re catching the error like this:
CleanShot 2024-04-29 at 17.38.08

Which no longer works as a byproduct of whatever is going on here.

Extra debugging information:
When you use a value step to catch the error like so:

Then this value is not set (which I do expect to happen since it’s in my catch. Instead of that I get:

However! If you add a string again, it does behave as expected and shows me what’s in the ‘catch’ block:


CleanShot 2024-04-29 at 17.40.44

Bump, this is making a lot of our logs useless which leads to being partially blind on production :frowning:

I assume you use NodeJS, try the following update

server.zip (1.4 KB) Unzip in lib folder

Thanks @patrick
Yes NodeJS, this Partially fixes it.
It works in the response step, but I still can’t access it as a variable how I used to do it:

For example in the logging extension:


CleanShot 2024-04-30 at 15.55.33@2x

It does work if I add a string again like before:

Same behaviour for a ‘set value’ step:

But then I add a string before the $_ERROR binding again and it works:

The problem is that in JavaScript an Error object is not serializable in JSON and is ignored. I added an extra replacer function for the JSON output that converts the Error object to a string. Easiest way to output an Error is by using the toString() formatter. I will investigate for some other solutions.

Hmm did something change though in your code? I’m confident it was working this way before