Debug app code

I also cannot use breakpoints with HP2023. I get some message on an unbound breakpoint cannot be set. I tried both --remote and docker.

With HP2016 it does work however. But there I get a message about 32bit not supporting async stuff.

At the moment I’m working on updating the Ring app to SDK3, I’m doing that on an older Homey so to not run into differences between the old and new Homey so I haven’t tried these settings yet on my new Homey.

Breakpoints are working for me on HP23 after setting the remote folder like ind Danees example:

"remoteRoot": "/app/"

Almost there I think. But the app won’t really run and I cannot sent breakpoints and get: “Starting inspector on failed: address already in use”

So still miles away :smile:

Do you have some morte details so we can help?

  • HP19 or HP23?
  • If HP23, is the app running on Homey (homey app run --remote) or in Docker (homey app run)?

Your error message says that there is already a debugger process running on this port.
If you have more than on app running in debug mode, make sure you are using unique ports for every app.
If you are trying to start the debugger on HP23 Docker, it won’t work because the process is already started. You must connect to this process instead.

If you are running on an HP 2023 use “homey app run --remote” else it will run in Docker which already has inspector running.

You could also try a different port instead of 9225 just in case another app is using it.

Here is example code that tries first to connect (docker) or starts debugger (Homey).

Fiddled around a bit and got it working… thanks.
This speeds up development quite a lot.

You’re a genius!
The waitForDebugger line is probably needed when debugging SDKv3 apps because the execution order for the onInit methods has been changed.
I ran onto the problem of non-binding breakpoints while trying to update my app to SDKv3 and setting a break-point early on in the app execution, running on a 2016 Homey.

Hi all. Has anyone got this working with a Typescript app instead of JS? I’ve got as far as being able to attach the debugger, but can’t set breakpoints (they’re shown as a grey circle). The diagnostics shows the following:

Screenshot 2023-10-19 at 09.19.03

I’m assuming that the tsconfig.json file will have no effect on homey app run. Another option is to pass --sourcemap to the typescript compiler, but how is that possible when it is compiled by homey app run ?

I’m also getting the “Warning: Async stack traces in debugger are not available on 32bit platforms” warning, but would that prevent breakpoints from being set?

Thanks in advance for any assistance.

Instead of assuming, have you tried?

Hi @robertklep yes, I have. It looks like tsconfig.json is used to provide compiler options for when compiling within VSCode. I don’t think the Homey build/run process will be aware of it.

If you had tried, you’d have found that adding "sourceMap": true to the compiler options in tsconfig.json causes source map files to be created in the .homeybuild folders, just as the hint suggests…

$ la .homeybuild/
total 28
drwxrwxr-x 12 robert wheel  384 Oct 19 13:15 ./
drwxrwxr-x 16 robert wheel  512 Oct 19 13:35 ../
-rw-rw-r--  1 robert wheel   43 Oct 19 13:15
-rw-rw-r--  1 robert wheel   34 Oct 19 13:15 README.txt
-rw-rw-r--  1 robert wheel  510 Oct 19 13:15 app.js
-rw-rw-r--  1 robert wheel  271 Oct 19 13:15

Ok, thanks, I saw those but hadn’t realised that they weren’t present before I had added it.

I’ve now seen another error message after stopping the debugger - “Could not read source map for file:///app.js: ENOENT: no such file or directory, open ‘/Users/grant/violet/HomeyApp/com.violet-ultra.smartswitch/’”
So, it’s looking for the map files in the root dir (the same one as the .ts source files), not the .homeybuild dir. So that’s a step forward.

I’ve got it working by updating "localRoot" in launch.json to be
"localRoot": "${workspaceFolder}/.homeybuild",

Thanks for the help @robertklep

1 Like