Debugging not working in Intellij - NodeJS + NestJS App - node.js

I am trying to debug a nodejs + nest application in IntelliJ, I am able to start the application using two types of configs.
Using Yarn (through NPM configuration template in intellij)
Using Node (I am not sure but when I use the main.js from dist folder then I get some debug point but it is useless as it is not pointing to my actual code base)
Debugger doesn't work for any of the above options!
I am posting screen shots of both the configurations.
New to Node + IntelliJ, so not sure what did I do wrong in both the configurations! Any help would be appreciated.
Intellij Version is 2020.3.3 And NodeJS application exposes several APIs, I am trying to call the APIs using a Postman and expect it to debug.

Debugging in both main.ts and controllers works for me when using the configuration below:
See also https://github.com/nestjs/nest/issues/993 for some recipes

Related

How to debug a serverless framework plugin?

I've searched throughout google about this question and I had no success...
I want to work on a serverless plugin fix, but I don't know how to attach the process to debug the code.
Currently, I'm using vscode and the plugin was developed using nodejs + typescript.
Does anyone have any tip or article explaining how to do that?
As every other process, that you want to debug, you need to run it and somehow connect the debugger to it.
You need to remember, that Serverless Framework is written in JS/TS, so it runs in Node.js. So you can debug it quite easily, if you are developing your Lambdas in Node.js, as it's quite common environment.
How to do it using Jetbrains/Webstorm/IntelliJ
Go to your node_modules directory and find the source code of the plugin, that you want to debug.
In the source code place the breakpoint.
Now Create a new "Run configuration" in IDE for NPM, that should be similar to mine:
4. Make sure you've chosen the correct package.json!
5. Now simply start debugging, like you normally do, but choose the run configuration, that you've just created.
In my example I'm using package script from package.json, but it could be also any other script, that triggers serverless deploy or serverless print in the end.
And that's it! Breakpoints should be triggered normally, like when you debug your own JS code.

Create a build for Node.js (fastify) server to electron app

I am using node js 10.15.0 along with fastify server int it.
I am also using normal public folder shared in the project.
Below is the project hierarchy.
NOTE: This code when started, starts as a standalone server which also servers UI.
I tried electron-packager/ electron-builder but I am not getting desired build as executable like .exe etc.
Question:
Can anyone please guide me through how can I achieve creating a build from node.js pure server code using fastify.

VSCode debugger with webpack and node js - breakpoints grey -> "breakpoints set but not yet bound"

New here. I am trying to configure vscode debugger for my node.js web app. Used tech is node.js, webpack, pug and plain old js. I have followed several guides and steps to try and configure this and admittedly lack of understanding of different parts is key issue here.
Aim: start localhost with webpack and have breakpoints in server files and front end files that will help to debug or at very least tell me what variables are being transferred at any given time.
Issue: constantly getting message "breakpoints set but not yet bound".
Any help would be greatly appreciated!
Below pasted files that I am using to run this and console output --> Configurations used (this is basically one of the latest examples I have tried):
launch.json
package.json
webpack.config.js
console output
followed by server started

Debugging Selenium JS application on NodeJS

Im NodeJS newbie. I have JS application for running selenium-based tests of web aplication. My problem is that I cannot debug this application.
How to debug my JS application. My editor is Visual Studio :) or any simple text editor.
My application is started by code
node src/test/UI/app/Tests.js
Any module needed for debuging JS apps started under NodeJS?
As an example, you can debug your Node.js in WebStorm.
There are two scenarios of how you can do that.
Remote debugging. In that case you need to run you test with --inspect flag (node --inspect <pathToTest>). Then you need to create a debug configuration (port 9229 is a default debugging port used by Node.js). See details on the screenshot bellow.
Start Node.js app through WebStorm debug configuration. In that case you just have to specify another debug configuration by setting path to node binary and specifying application entry point (in that case it is your test file). Screenshot bellow illustrates details.
After that set a break point and launch your selenium test.
Happy debugging.

How to debug React Express Webpack app in WebStorm

I'm trying to debug the back-end of the react - express application. I'm using webpack for bundling.
How to edit configuration on WebStorm so that I could debug both front end and back-end? I'm using WebStorm 2016.
You need to create and start a Node.js run/debug configuration to debug your server-side code and create and start a JavaScript debug configuration for the client-side code.
In the Node.js configuration in the JavaScript file field you need to specify the path to file that kicks off the server.
In the JavaScript configuration in the URL field specify the URL your server is running on. You might also need to configure the mappings between local paths and remote URLs: that's most probably should be between the folder where the component are located and webpack:///. (see this answer for more details).
Also make sure that you have dev-tools: 'source-map' in your Webpack configuration.
Went through some documentations on WebStrom and finally managed to get it working. First select Edit Configurations then a menu will pop up which will allow you to edit Run/Debug Configurations. Click the + button on the left side and add a node js. From that change the Node interpreter from default(local) node_modules to the babel node inside your project dependencies. eg ~/MyWork/Project/node_modules/.bin/babel-node. Then Add --presets=babel-preset-es2015 as Node Parameters. Fill the rest of the configurations and click save and run the project.
Here is an example:

Resources