ACTIVE_HANDLEThis step was still trying to run code when the step ended. Make sure you promisify callback functions and await all Promises. (Reason: GetAddrInfoReqWrap, Learn more: https://pipedream.com/docs/workflows/steps/code/async)
Dylan Sather (Pipedream) : Can you add an “await” before performSearch?
Also I would recommend creating a new client secret for the app. Once you’ve made that public, anyone can technically issue tokens on your behalf and it’s always a recommended practice to rotate it. I recently wrote up a security guide for Pipedream that discusses environment variables and other things that may be helpful: https://pipedream.com/docs/privacy-and-security/best-practices/
Dylan Sather (Pipedream) : Oh sorry I see now you chain the then method so that’s probably not the issue. Mind sharing the workflow with dylan@pipedream.com and I can take a deeper look?
Dylan Sather (Pipedream) : no worries, I made just a few modifications. The workflow is throwing a 403 error now, but the Promise / async-related errors should be corrected.
res.text() returns a Promise, so you’ll want to await all instances of that (see the node-fetch docs). Where you were calling performSearch recursively on line 81, you were also missing an await there, so that could have caused an issue. I also modified the then / catch method chaining at the bottom to use await, instead, which I personally find more readable (you can use try / catch instead, if you’d like to handle those errors in a custom way).
Dylan Sather (Pipedream) : yes if a destination doesn’t whitelist the IP, you’ll typically see a TIMEOUT error since you can’t actually reach the destination host. So something is either off about the client / tokens themselves, or you’re not passing them exactly how they expect