PipedreamHQ / pipedream

Connect APIs, remarkably fast. Free for developers.
https://pipedream.com
Other
8.97k stars 5.27k forks source link

[FEATURE] Show request error body of Custom Request Action on Pipedream's Inspect View #4850

Open vunguyenhung opened 1 year ago

vunguyenhung commented 1 year ago

Is your feature request related to a problem? Please describe. I added an Webhook Custom Request action into a workflow and deployed the workflow. On Pipedream's Inspect View, when the Custom Request action has error response body, I couldn't see the error body so I couldn't easily debug it

image (6)

Describe the solution you'd like I can see the error response body of the failed Custom Request action

Do you have a workaround? Currently I can see the error response body in the Builder UI, but it's hard to select the right event to debug

Screen Shot 2022-11-30 at 11 19 39

Additional context Reported by a customer here: https://pipedream-users.slack.com/archives/CPTJYRY5A/p1669780868644409

riteshbxr commented 1 year ago

Another Workaround is to use code block instead of Webhook Block

const response = {};
try {
    const res = await axios.post("...myUrl..", payload, {
        headers: {
            header1: steps...headerRef,
            Authorization: `Bearer ${steps...tokenRef}`,
        },
    });
    response.responseStatus = { status: res.status, body: res.data };
} catch (e) {
    response.responseStatus = {
        status: e.response.status,
        body: e.response.data,
    };
    response.isError = true;
}

if (response.isError) {
    throw new Error(JSON.stringify(response, null, 2));
}
return response;