-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Research item: Remote debugging #223
Comments
Derek add label: hacktoberfest |
So this is a little rough, but it could be a start. Using Node 8+ I was able to add debugging with Chrome dev-tools by exposing a new port and overriding the default I used the Node template from the CLI but swapped the base image for Node 8 to make use of the To start debugging just invoke the function with curl or the cli, open chrome browser to chrome:https://inspect, there should be a Node icon at the bottom with the option to inspect.
I don't have VSCode but dev-tools does allow break-points and stepping through the code. I think you could do this all via the CLI, but I dont think you can map ports? so something like this might work if ports are mappable from the cli.
|
With some help from Austin I figured out how to do this in Python. I created a python function, and modified it to look like this: https://github.com/ericstoekl/misc-functions/blob/master/python-dbg/handler.py Then I built the function into a docker image. Next I re-deployed the whole swarm, modifying
After the stack is deployed, if I call the
And it will connect to the listening debugger. In conclusion, maybe we can add an option/flag to the |
The issue I ran into with debugging was:
The afterburn example re-uses the process so that could be a way of debugging since when you attach the process is already running and will stay running. Otherwise some deliberate sleep etc. How did you go about it guys? |
Using the |
Following @austinfrey 's steps, I've confirmed debugging works with VSCode, too. The
Be sure |
thanks for testing @kenfdev , @alexellis if this is the route we want to take for NodeJS would it be helpful to add ti to the NodeJS starter guide, or would it be best as a a separate guide? |
I think we still need additional research since doesn't this currently require us to In terms of a guide, we should write this up for each language - perhaps in a single place when we have dug deep enough. |
As my 2 cents: Got to debug FaaS via WDB: https://github.com/Kozea/wdb You need to poke a hole from the FaaS machine to your machine. I am opening the hole via Ngrok service for now. Then you tell the debugger to attach to the hole on their end, opening the breakpoint on your machine. Needed options on the FaaS environment:
You need to keep an eye on localhost:1984 and open the stopped session, but this is very minor. |
Forgot to mention: WDB is a Python package. Use with Python functions. |
https://www.youtube.com/watch?v=uZPXwuKxsEU Video: How to debug a Node.js function on Kubernetes with OpenFaaS |
Has anyone set up debugging for golang? |
/lock: inactivity |
Research into debugging deployed functions remotely.
Idea - if a function container image contains additional tools and exposes an additional port then breakpoints can be set and hit and a remote debugger can be attached.
Workflow - configure metadata - build image, deploy function, open VSCode and attach to remote debugger. Hit breakpoint inspect values etc and disconnect.
Initial languages to explore:
https://pypi.python.org/pypi/remote-pdb
https://nodejs.org/api/debugger.html
https://code.visualstudio.com/docs/nodejs/nodejs-debugging
https://github.com/Microsoft/MIEngine/wiki/Offroad-Debugging-of-.NET-Core-on-Linux---OSX-from-Visual-Studio
The text was updated successfully, but these errors were encountered: