Questions and discussions about using the Shopify CLI and Shopify-built libraries.
I'm making a sales channel app which requires running a backend server. Is there anyway to debug this app while I am running locally? The problem is the app is launched from shopify.exe and even though it runs nodejs somewhere down the line, visual studio seems unable to debug with it. Is there anything that can be done?
Solved! Go to the solution
This is an accepted solution.
Hey I managed to do it and it was easy. Just go to run->add configuration and then add a "node" configuration.
This is an accepted solution.
Hey I managed to do it and it was easy. Just go to run->add configuration and then add a "node" configuration.
Glad you figured this out Zhicheng1 - thanks for coming back to update this post 🙂
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
can you put any more details?
Hey @GeorgeHoffman ,
Are there any additional details you're specifically looking for?
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
I just did click on show al configurations and then selected the dev script from package.json
This will open a terminal with command and debugger attached
I also can't hit any breakpoints. Anyone any ideas?
Here are the steps that worked for us:
1. In VS Code, hit F1 and type add Configuration and choose the option Debug: Add Configuration to open the launch.json file.
2. In the launch.json file, add this in your configurations array. You might want to tweak it depending on your package manager and folder structure (this is working with yarn and the package.json at the root of our workspace folder). The "yarn dev" script looks like this in our package.json file "dev": "shopify app dev"
{
"type": "node-terminal",
"request": "launch",
"name": "Debug Shopify App",
"command": "yarn dev",
"cwd": "${workspaceFolder}"
}
3. Click on the Debug icon in VSCode, then select your newly added configuration and hit play. It will start your debug session and you will be able to hit breakpoints
I tried this, but when I try to select a breakpoint it, says that it's unbound.
I followed the instructions, but my "command "is not `yarn dev`, but it's `shopify theme dev`.
Maybe there is another setup I need to do to my environment to make it work with yarn or npm?
I think breakpoints doesn't work in code running in front end, just in the code running in backend like loader or action functions. you may try writting a line witgh the word debugger and open the developer console in the web browser to check if the code stops there.