PostResponseMap hook not being called
Hello,
In debugging a flow that was not functioning as expected, I was able to narrow the problem down to a postResponseMap hook. Despite adjustments to the script, however, the future steps were reporting the same errors. Finally, I replaced the body of the hook with this code:
function postResponseMap(options){
throw new Error("test")
}
When testing in the editor, the code immediately throws this error, as expected:
Message: Error: test
Location: <anonymous>:2
Stack: Error: test
at postResponseMap (<anonymous>:2:9)
According to the docs,
* Throwing an exception will signal a fatal error and fail the entire page of records.
Despite this, whenever the flow is run with this hook, no error results. This leads me to believe that rather than an error with the script itself, the script is not getting called in the first place. I did try removing the script and creating a new one; the result was the same.
Is this truly a bug or am I missing something?
Comments
Hi Ezriah,
Could you please provide me the flow screenshot so the we can debug on this.
Thanks.
Ezriah can you try this and then check the script log to see if it gave an output?
Side note: I'm not able to reproduce this with imports or lookups. Can you download the flow and send share link for us to download it?
Tyler Lamparter Yes, your script produces an output. I also tried edits to the records, and these show up on the preview, but then nothing changes when the flow is actually run.
Likewise, when I am in test mode, the script triggers (for the actual script, the logging script, and the error script). However, when I switch the flow back on, the hook is no longer triggered (I copy-pasted the real data into the initial step and used a single record export to ensure they were being called on the same data).
Additional debugging I tried:
@John The flow export is here: https://drive.google.com/file/d/1vipD4hn3-xywjy7w394QstwlI5IMMqXe/view?usp=sharing.
Thank you for your time!
Ezriah I'm not able to install that flow. Did you hit download flow from the top right buttons?
Also, if the console log is working, but your script isn't, then the script response may be malformed. Can you comment with your script and try to resend the flow zip?
Tyler Lamparter I am pretty sure that this does not have anything to do with the script itself because I stripped the script down to a single "throw new Error()" line. In the preview, this error is thrown and there is no output. When the flow is run in production, however, the flow proceeded to the next step regardless. Then, I went to an unrelated flow in this integration, added this same script as a postResponseMap. Here, it immediately threw the error and stopped the entire page of records.
Both scripts:
and
produce expected output in the preview.
I downloaded it again; here is the link: https://drive.google.com/file/d/1t-3hIrepBHwJk87lvnM7xodCoO25zscU/view?usp=sharing.
Tyler Lamparter I recreated the entire flow from scratch (not just cloning or attaching the steps), but regardless of what I did, the script would not be called. Finally, I just copy/pasted the script into a preMap hook instead; it worked instantly (after modifying the return structure to accommodate the preMap structure). There seems to be some weird bug that is preventing this postResponseMap hook in particular from triggering. Looking back through the docs, it does seem like there had been some issues with this hook in the past. Fortunately in my case, there was only one more step in the flow, so the preMap worked fine. Hopefully someone will be able to identify the cause of this before someone has a longer flow with 3+ preMaps to maintain!
Thank you for taking the time to look over this issue.
Ezriah apologies for the delay, I was out and then at SuiteWorld. Separate from the above issue, with transformation 2.0, you don't need to use handlebars here and can use the drop down field selection. Any reason you used handlebars, just curious?
As for the issue, I'm not able to reproduce it at all even with your flow zip. When using your zip, it's working fine and throwing an error. Let me check internally to see if engineering has any idea why runtime would potentially vary. Can you provide a screen recording by chance?
Ezriah can you please create a support ticket so we can be invited to your account and further debug? Screen recording would really just confirm what you're saying is happening.
Tyler Lamparter Thank you for the assistance. Support and I are not sure the exact cause, but it appears to be resolved now. Thanks again for taking the time to look into this!
Re: the mappings, no, I did not have a good reason for using handlebars. I had been under the mistaken impression they were required to map array members. Glad to learn I was wrong!
Please sign in to leave a comment.