Is there any way to reprocess HTTP requests sent to event sources?

This topic was automatically generated from Slack. You can find the original thread here.

Jordan Harrison : My incoming responses are all in one line, and seem to be missing an extra set of braces around the body event. Any advice for fixing this one?

I was using Pipedream to catch form data from a static site by making a POST request to a webhook, but I seem to have messed up the formatting a bit getting things to redirect properly after submit.

I’ve caught about 75 entries that I can hopefully reprocess on Pipedream (without extracting all the data manually from logs:upside_down_face:) once I’ve figured out the body issue.

Dylan Sather (Pipedream) : were you aware that event sources are just Node.js code behind the scenes that can be edited in any way? Just click into the source and visit the Configuration tab.

Both the data emitted by the event, and the summary you see on that line, is controlled by the this.$emit function.

Let me know if that helps

Jordan Harrison : I was, this is one of the key reasons I use pipedream :slightly_smiling_face: I tried a few simple changes to this part but wasn’t able to get anything working. Do you have any more suggestions for getting that part wrapped in braces? I’m very new to Node and JS

Dylan Sather (Pipedream) : In your first screenshot, on the left, it looks like that data might not be getting passed as JSON, so Pipedream isn’t converting it to its JavaScript-object equivalent.

Does that sound like it might be the issue?

Jordan Harrison : Yes! I’d done a little research on whether it needed to be sent at JSON payload or compared the responses of a correct response and an incorrect response and spotted this error.

Jordan Harrison : _"content-type"_: "application/x-www-form-urlencoded",

This line stands out, but really only adds a tiny bit more

comparing it to the correct response log, I see charset=UTF-8 added. _content-type"_: "application/x-www-form-urlencoded; charset=UTF-8",

Dylan Sather (Pipedream) : That’s right. To get a nicely-formatted object, you’ll need to send the data as JSON and should send it with a content-type of application/json

Jordan Harrison : Is there a way to fix this via Pipedream side instead of modifying the code on the sending website? I’m understanding my content-type error now, but I’m hoping I can just reprocess the last events in Pipedream with new code to salvage the data in a sort-of automated way. I appreciate your help with this so far, I’ve learned a lot.

Jordan Harrison : Could I add in that content type declaration in this section?

Dylan Sather (Pipedream) : You can’t reprocess events sent to an event source in this manner. You’d have to send the data to the HTTP endpoint again, and use a technique like this to parse the URL-encoded form data into a JavaScript object. Note that where that example references window.location.search, you can just replace it with event.body.

If you’re triggering a Pipedream workflow from that event source, you can replay events sent to the workflow, which means you could handle the conversion logic there and send the data to whatever destination you’d like from the workflow.