Different outcome for request history and debugging with Get All Input

Options

Hi there,

So I'm trying to debug an error with handling payload from Get All Input. I cannot go any further as I'm getting two completely different results (outputs) for the same input values when I use Run & Debug and when I look at the Request history.

  1. Request history:

Here the output is:

{"message":"Unable to locate var: verification_id.response.result.url"}

The function stack executes pretty much the full scenario.

2. Run & Debug

When I copy the input from point 1 above and Run * Debug with it, I get the following result:

{"message":"Unable to locate var: payload.firstName"}

The function stack stops at the very beginning.

My use case:

I'm getting a payload from a Webflow form encoded in x-www-form-urlencoded and I'm trying to access each individual value like payload.email, payload.phoneNumber etc. The problem is that when the value is omitted in the form (for example phoneNumber is empty), there is no such field in the paylod (payload.phoneNumber does not exist) so I'm trying to get over it somehow by setting it the phoneNumber to null anyway as a variable. Unfortunately, because of the above error I cannot figure out a way of doing it properly.

Tagged:

Best Answer

  • Tom Wolf
    Tom Wolf Member
    Answer ✓
    Options

    Ok, problem solved. I found the following advice from Ray Deck in this thread:

    "Put your form-encoded string into the payload directly as a Create Variable call and disable the Get All Input call for the purpose of testing."

    I did that and was able to finally properly debug the function stack.

    Thanks anyway Paweł!

Answers

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    Try to use "get" filter while defining variable so payload(get phoneNumber [default null]) this way even if the path is missing you will always get a null not an error that the parameter is missing.

  • Tom Wolf
    Tom Wolf Member
    edited April 2023
    Options

    Cześć Paweł :)

    Thanks for the reply! When doing some trial&error I did try the get function (as you can see on the screenshot all other variables use this method), but it doesn't solve the problem.

    I re-added it to firstname variable and here's the result when I Run&Debug:

    Result:

    {"code":"ERROR_CODE_INPUT_ERROR","message":"Missing param: field_value","param":"field_value"}

    For some weird reason, all of the variables are null even though there are not null in the payload (input).

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    I'm not sure from what I'm seeing on the screenshot, but maybe there is another layer in JSON path? can you stop&debug payload itself?