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
Also how o I set the timeout on an API call node ?
@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.
For timeout you can use setTimeout() function.
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 ?
right
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
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 ...
You did a workflow test or node test? This shows up only on flow test
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 ?
In the log I get this
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
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.