Many thanks and most of the credit to Delba over at Vercel!
We were able to find a way to return a response from a first endpoint and then wait for a second endpoint to complete.
This stemmed from Slack requiring a response within 3000ms—but if your endpoint takes longer (for instance if it needs to fetch data from another third-party), this results in a timeout message in Slack.
This leverages middleware.ts with some regex to work on any path ending in /incoming and then routing the request to /worker.
Hi @jpvalery, thanks for putting it here. Are you able to use it with the slack bolt SDK?
Here's how I tried it but not able to make it work so far:
When slack hits my /
incomingendpoint, it triggers above given middleware andreq.formDatathrows an exception that it only supports url-encoded and form-datacontent-typeheaders while slack sent application/json I guess 🤔In
fetch()I was hitting a/boltendpoint which initialises bolt app - it hits the endpoint succesfuly (logs appear) BUT bolt app doesn't handle the slack payload and hence no slack event/action/listener gets triggered.Am I missing something here?