slackapi / deno-slack-sdk

SDK for building Run on Slack apps using Deno
https://api.slack.com/automation
MIT License
155 stars 27 forks source link

[FEATURE] Allow remote debugging `slack run` #274

Open spoike opened 6 months ago

spoike commented 6 months ago

Description of the problem being solved

I find myself in situations while developing a Slack app that I need to check what payloads are being sent into functions etc. Deno supports remote debugging via V8 Inspector protocol, unfortunately these flags (--inspect or --inspect-brk) can't be passed via the slack run command.

Alternative solutions

The workaround is that you can log variables directly to the output with console.log (poor man's debugging). However some payloads are nested (such as BlockActionHandler and ViewSubmissionHandler) which get truncated by the console logger which this alternative cumbersome to do.

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

Sure, lets go! 🤘

hello-ashleyintech commented 6 months ago

Hi, @spoike! Thanks so much for the feature request! 🙌

I have passed this along to our Deno team - they're currently OOO, so it may take at least a week to get a response, but I have surfaced it and they'll get back to it whenever possible! 🙇

anthonygualandri commented 6 months ago

@hello-ashleyintech Also interested in being able to debug remotely in a local editor env like @spoike described. If this is not possible, is there some guidance on making debugging in local test mode easier in a similar way? Thanks!

WilliamBergamin commented 6 months ago

Hi @spoike and @anthonygualandri thanks for writing in 💯

We have explored the idea of introducing a slack run --debug mode using the --inspect and --inspect-brk flags

Unfortunately this resulted in an unstable developer experience since the CLI is designed to mimic a lambda invocation by spawning Deno processes for each request, this behavior proved to be incompatible with the V8inspector clients since they were not designed to handle multiple short lived Deno "debug" processes

At the time no developers had asked for debug support therefore we stopped our work on it. This seems to be the first request for it 🥇

is there some guidance on making debugging in local test mode easier in a similar way?

There was no simple way to set up debug mode locally, we were only able to debug the first request sent by Slack to an application and this was still unstable. But let me know if you would like some information on how you could tests this out?

However some payloads are nested (such as BlockActionHandler and ViewSubmissionHandler) which get truncated by the console logger which this alternative cumbersome to do

Allowing console logging of BlockActionHandler and ViewSubmissionHandler might be a lower lift short term solution let me know if it would help?

spoike commented 6 months ago

Hi @WilliamBergamin thanks for answering. What prompted this feature request for me personally was two issues that I was having that would've cleared up with some debugging:

The more wild idea is to allow interactivity with the program through some ncurses-like window to set up debug watches on some variables/arguments... but then we're talking about writing your own debugger which I'm pretty sure is out of scope for slack run. 😅

nicholastettenborn commented 6 months ago

+++ on the requirement for a Step debugger. I am very surprised that no devs have requested it.