Monitor node js post request to remote server

Hi. I’m a newbie on Wappler and learning it with the Docker/Nodejs set up after following Ken’s excellent tutorials.

I’m replicating some Python code to make a POST request to a remote server. The problem I have is that when running the Server Action the remote server is returning a status 200 response but the content of the response is wrong. I can get similar data back correctly using a GET request so it looks like the problem is in the body of the POST request.

I know there are Nodejs tools that allow the full POST request to be seen so I can look at where the problem lies but I don’t know if this can be achieved in Wappler as the Server Action is being executed directly rather than through a front end (where the debug feature works?)

Is there a native Wappler way of doing this? Thanks

Hi,

What we usually do is make use of Set Value & Response steps to return values from server action in between. This helps us check what data is being sent to the server, and upto which part the server action is running before returning error or not returning unexpected value.

To begin you could try to just set a response step with status 400 and value as {{$_POST}}.

Alternatively, I think all requests being made to the NodeJS server, specifically, do output some lines of code in the bottom server output region in Wappler itself. Not very well-versed with NodeJS but that might be helpful to you too.

Thanks for responding Sid. Am I right in thinking that your suggestion applies to a post request made by a front end to the Nodejs server?

I am not using a front end yet. I am just testing the operation of a Wappler server action which makes a request to an external server that has the data I need for my app. It is that external request I am trying to examine because the external server returns data with no error but the data is incorrect (parameters to filter the returned data aren’t being used).

I am replicating the external call made in my Python code but the post body content in the call Wappler generates from the Nodejs server must be different and that’s what I want to compare.

Ah. I understand now.
Maybe share some screenshots of Wappler API step and what Python script is sending?

Thanks for the advice Sid.

Before I do that is there maybe a method to solve this that we have missed @Teodor?

You can make use of Beeceptor or similar service. Instead of the actual destination URL, put in beeceptor’s custom endpoint in URL and you can see what the POST body looks like there.

Thanks. I really appreciate your help Sid