I’m trying to debug a sample service using WebStorm. I’ve followed the instructions in the tutorial and created a Debug Configuration for Nodejs in Webstorm with:
Working Directory: D:\work\XXXXX\Backendless\Tutorial\ShoppingCart
When I invoke the debug for the service, I can see the service is deployed with “DEBUG” mark in the “API Services” section (see attached screenshot):
and I get the following in the debug logs in the console:
"C:\Program Files\nodejs\node.exe" D:\work\XXXXX\Backendless\Tutorial\ShoppingCart\node_modules\backendless-coderunner\bin\coderunner
Debugger listening on ws://127.0.0.1:56586/66e0bbd5-1b9c-4c4b-9c97-66ea341b493d
For help, see: https://nodejs.org/en/docs/inspector
22:37:21.042 Copyright(C) 2020 Backendless Corp. All rights reserved.
22:37:21.165 Starting Debug Code Runner...
22:37:21.165 Building Model..
22:37:21.847 ServerCode Model built in 681ms
22:37:21.849 Event handlers (1):
22:37:21.850 persistence.beforeUpdate (customers) (app\services\customer-service.js)
22:37:21.851 Timers (1):
22:37:21.851 CoolTimer (app\timers\cooltimer.js)
22:37:21.852 Custom Types (4):
22:37:21.855 customers (app\models\customer.js)
22:37:21.857 addresses (app\models\addresses.js)
22:37:21.857 Order (app\models\order.js)
22:37:21.858 ShoppingItem (app\models\shopping-item.js)
22:37:21.859 Services (2):
22:37:21.860 CustomerService (app\services\customer-service.js)
22:37:21.861 ShoppingCartService (app\services\shopping-cart-service.js)
22:37:22.373 Registering Code Runner on https://api.testXXXXXX.net
22:37:23.570 Runner successfully registered.
22:37:23.571 Registering Model on https://api.testXXXXXX.net
22:37:24.460 Model successfully registered
22:37:24.461 Waiting for Server Code tasks..
**22:38:08.759 Debug Session ID doesn't exist on server**
Waiting for the debugger to disconnect...
Process finished with exit code -1
As you can see in the logs, I’m getting the error “Debug Session ID doesn’t exist on server” and the debug stops. Am I doing something wrong here?
@Vitaly_Vengrov, do you experience the same problem? What version of the JS code runner do you have?
By the way, I’m using Webstorm on Windows. Do you think this might be the cause of this problem?
We will investigate this issue and report back to you.
Try using a later version of the JS code runner. You can change the version of the coderunner in the package.json >> backendless-coderunner. The last version is 6.0.2, but you use 4.7.2.
Thanks for the hint, however, I’m afraid it didn’t help. I’ve updated coderunner to version 6.0.2 and used npm install again … nothing changed … same error.
One note though. I’m using this coderunner.json file:
Do you think I might have something wrong in the .json file?
When coderunner stops, do the services disappear from console? I mean the services which shop up in the “Services in Debug” section.
Sorry for my late response. Yes it does disappear.
I have a question though about the
msgBroker … I don’t understand it and I couldn’t find documentation about it. If you can take a look at my config for coderunner.json, I’m using the:
while I’m running on a server url:
do you think this might be the problem?
The configuration you mentioned (
"host":"cl.backendless.com") is for our cloud installation. For your own installation of Backendless, it needs to be the configuration of what we call “Debug Redis”. Check with the devops team, they will provide you with the details.
I see … thanks Mark … I’ll check
It worked. I had to set the Redis
host and after that, debug started working. To be honest, I think this should have been mentioned in the documentation in a more clear way.
Anyway, after getting this to work, now, the code fails with this error:
400 - Could not parse request with message: , status code 404, headers GET /XXXXXXXXXX//data/Preference?pageSize=10&offset=0&where=key%3D%27Test%27 (8002)
Although this same code works fine if I’m not debugging code (
npm run deploy). Please notice the double slashes
// in the url. It seems that
apiKey is missing in there?
Anyway, to solve this, I’ve upgraded
coderunner npm package to v6.1.1:
and now, everything is working perfectly … Thanks a lot of the help!