Improve listen command
driesvints opened this issue · 5 comments
It would be cool if we could somehow get the event name and ID in the output of the listen command in similar fashion as the stripe listen
command. I'm not sure if that's possible though because Expose controls the output here. cc @mpociot @DanielHudson
Yes, currently the output from both expose and ngrok are not looking great.
The only way I can think to do this for both services is to log incoming webhooks via WebhookHandled
, and then have the command do some kinda of tail -f
equivalent in the "process" loop.
Downside is you'd probably need to always save the webhook logs either when not in production, or when LOG_LEVEL=debug, unless a specific config is added.
Happy to have a look at this if it sounds useful.
So the way I want to approach this with Expose is to have some kind of payload specific output.
We would have an array of "drivers" that detect which URL the request is coming from. If it's from a URL that is registered, we would parse the payload and the driver can then take care of rendering the CLI output. This way this could be added to Expose for all sorts of providers.
@mpociot that would be fantastic really.
Happy to take a look at the alternative solution when I get a sec if it helps, my suggestion should also work for ngrok too...
We could switch to @mpociot suggestion later if the feature becomes available. (Maybe it already is?)
@DanielHudson can we also create a file somewhere when the listen command gets executed, tail it like you suggested and on the WebhookHandled check for the existence of such file and write to it? after the command exits delete the file like you delete the webhooks