Stephen
Stephen3w ago

Stephen - How do I log an API call to see what ...

How do I log an API call to see what the encoded URI looks like? Or how do I debug an API call node ?
12 Replies
Stephen
StephenOP3w ago
Also how o I set the timeout on an API call node ?
Gaurav Chadha
Gaurav Chadha3w ago
@Stephen You can add logging statements on the node logic of API Call node to log the encoded URI- https://docs.buildship.com/logging
Logging – BuildShip
A unified resource to start building your backend with low-code. Dive into triggers, nodes, and step-by-step guidance to jumpstart your workflow creation.
Gaurav Chadha
Gaurav Chadha3w ago
For timeout you can use setTimeout() function.
Stephen
StephenOP3w ago
I want to set the timeout of the http call, I'm not a JavaScript guy but ot looks like timeout is simply a delay ?
Gaurav Chadha
Gaurav Chadha3w ago
right
Stephen
StephenOP3w ago
I want the HTTP request to fail after 5 seconds .. there is no setting in the node to support this .... ChatGPS gave me an example using an AbortController but it seems to not work
Stephen
StephenOP3w ago
So I added this code to a node ... logging.log('Starting to fetch pricing data ...'); const headers = { "Content-Type": contentType }; if (authorization) headers["Authorization"] = authorization; let queryParamsString = ''; if (queryParams) { queryParamsString = '?' + new URLSearchParams(queryParams).toString(); } logging.log(queryParamsString); return; Nothing shows up in the logs ... The node goes green and nothing ...
No description
No description
No description
Gaurav Chadha
Gaurav Chadha3w ago
You did a workflow test or node test? This shows up only on flow test
Stephen
StephenOP3w ago
Node test ... the API call is hanging and without the ability to find out why ... So I ran the flow test and it shows .. how do I set the HTTP timeout and not just a delay in the code flow ?
Stephen
StephenOP3w ago
In the log I get this
No description
Stephen
StephenOP3w ago
Does this mean I will not see the output in the test result ? OK .. so if I run the flow test it seems to run the API call node then if I click on it there is data But ... if I run the API call node directly there is no output and it seems to just hang ... I will send in a support ticket
Gaurav Chadha
Gaurav Chadha3w ago
also sharing the email reply here - It's an issue with the individual node testing which we are tracking. For now, you can use the entire flow testing - https://docs.buildship.com/testing#testing-entire-workflows to get and return the result of the API Call you are making. Regarding the "log output for the output too large to display" it is not an error or issue, we are excluding very large JSON responses in the logs system currently and displaying the above message due to cloud logging limitations. It should work correctly if you connect it with your client (frontend) and send the response. We'll update the limit and will improve the UX around this.

Did you find this page helpful?