Discussion (14)1
Log in or sign up to continue

A REST API call into a docker instance

Unfortunately, there is no simple way of any debug for any web requests. And it does not really matter in docker or not.

In a studio it is possible.
1. I put a delay of a few seconds in the service code.
2. Start the service
3. I find the required process, connect to it

BINGO! 
that''s the way to go.

I typically use from Terminal

>SET ^GO=0

and in code 

SET ^JOB($h)=$JOB FOR x=1:0 HANG 1 IF $GET(^GO) QUIT

and of course Studio to attach

or I use $system.CSP.Shell()  as described here
 

Actually, this way may also work in VSCode as well. It does support Attach to a process.

Good News! I was just not sure. Not to speed fake news smiley

In VS Code, you can create a debugger launch configuration for your API endpoint. Set the "request" attribute to "attach" and the "processID" attribute to the job ID of the production component that services your API. Set breakpoints and run this configuration. Then when a request arrives, you can debug the service and endpoints while viewing the REST request contents.

Here is a reference video; example starts at 4:00.

https://www.youtube.com/watch?v=diLHwA0rlGM

Classes extended from csp.rest class does not generate an objectscript jobid. So, is not possible debug rest services.

Good point. In the example I gave, the request is forwarded to a business process which has a job ID.

Yes, from Ensemble you have, but from csp.rest no. It is because web Gateway