Deterministic Hook Ids only work once, is this by design? #110
Replies: 4 comments
-
| I should add that I have only tested locally. After reviewing the code for world-local, it definitely returns the first hook it finds that matches the token. I am unfamiliar with the hooks api for Vercel, so I am unsure what the world-vercel getHookByToken function would return. I am guessing that the order of filenames predetermines that the first hook with the token will be the one always returned. If it is not the expected behavior that deterministic token names might be reused by subsequent workflow runs for the same user/channel/or whatever that determines the token name then is there another flow that might be suggested for my use cases? It's also plausible to add an option to the resumeHook method that prefers hooks attached to currently running workflows over those that have already completed. | 
Beta Was this translation helpful? Give feedback.
-
| I think I understand a little bit more. getHookByToken, nor resumeHook, perform checks to determine whether the attached workflow run has completed. It queues it as it should, and code elsewhere sees the workflow this hook is attached to is done, and so skips it. I think fundamentally the issue at the core of this is my desire to batch requests in short periods together. If I were to process each and every webhook received from my analytics provider, then having a workflow per action payload wouldn't be a holdup. However, there are a number of operations we take in post-processing that I need to think about. Though I heard on your RFCs batching is a common request you're hearing so maybe I'll wait for some insight on that topic before I dive further. | 
Beta Was this translation helpful? Give feedback.
-
| @brad-decker thanks for your patience here Right, so the idea with  It seems to me you've gotten that far and have been able to start collecting requests and batching to send into salesforce (fwiw, the idea for webhooks did spawn from me facing a very similar use case to what you're trying to build) - however it seems like there's som discrepancy between the local and vercel world implementations of how resumeHook should work. The ideal spec is that resumeHook works while the workflow is in the running state. once it's complete, that hook ID should no longer work (the webhook version automatically returns "HTTP 410 Gone" for instance) With that in mind, do you mind sharing a little code example of what you're trying to do and are struggling with. That might help us repro and see if there's a bug in the implementation or if it's usage/documentation, or if maybe the spec itself needs to be changed here | 
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Scenario:
This works as written; however, after this workflow is successful, subsequent calls to resumeHook return the hook created by the successfully completed workflow and then are skipped.
Is this by design?
My use case is that I have a webhook for analytics events. Each analytics event has an anonymousId (generated by third party, guaranteed uniqueness) and a userId if the user is known by our system. It also includes a number of other fields. I want to be able to achieve the following:
I think I have achieved what I want for the first instance of each anonymous id or user id (used in the token name) but once the first flow completes they'll never run again.
Also in the docs it looks like webhooks can be passed to steps for use, but when I try to pass a hook to a step for use it errors out and you can't create hooks in steps so it feels like I'm forced to put most of my logic for these queues into the main workflow. Is that accurate?
Beta Was this translation helpful? Give feedback.
All reactions