-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't debug Server Typescript in an Angular SSR project #27773
Comments
To debug SSR, you need to use the Node.js inspector. Run the command |
This commit introduces an `--inspect` option to the dev-server, enabling debugging of server-side code when using SSR or SSG. This option is equivalent to `node --inspect=[[host:]port]`. Usage examples: ``` $ ng serve --inspect $ ng serve --inspect 9999 $ ng serve --inspect localhost:9999 ``` Closes: angular#27773
This commit introduces an `--inspect` option to the dev-server, enabling debugging of server-side code when using SSR or SSG. This option is equivalent to `node --inspect=[[host:]port]`. Usage examples: ``` $ ng serve --inspect $ ng serve --inspect 9999 $ ng serve --inspect localhost:9999 ``` Closes: angular#27773
This commit introduces an `--inspect` option to the dev-server, enabling debugging of server-side code when using SSR or SSG. This option is equivalent to `node --inspect=[[host:]port]`. Usage examples: ``` $ ng serve --inspect $ ng serve --inspect 9999 $ ng serve --inspect localhost:9999 ``` Closes: angular#27773
Thanks for your reply @alan-agius4. I've just tried |
This comment was marked as off-topic.
This comment was marked as off-topic.
Correct, in that case you need to use
Are you attaching to the inspector process from your IDE? There are a large number resources online on how you can debug a Node.js application using various IDEs. |
This commit introduces an `--inspect` option to the dev-server, enabling debugging of server-side code when using SSR or SSG. This option is equivalent to `node --inspect=[[host:]port]`. Usage examples: ``` $ ng serve --inspect $ ng serve --inspect 9999 $ ng serve --inspect localhost:9999 ``` Closes: angular#27773
This commit introduces an `--inspect` option to the dev-server, enabling debugging of server-side code when using SSR or SSG. This option is equivalent to `node --inspect=[[host:]port]`. Usage examples: ``` $ ng serve --inspect $ ng serve --inspect 9999 $ ng serve --inspect localhost:9999 ``` Closes: #27773
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Command
other
Is this a regression?
The previous version in which this bug was not present was
No response
Description
I've created a new project with ng new --ssr and spent several days trying to figure out how to debug the server.ts file in VS Code.
I've tried using ts-node and tsx, with many different configuration changes in tsconfig.json and package.json, but couldn't get it to work.
I only managed to set a breakpoint in the generated server.mjs file, which isn't convenient.
I also don't understand how to work with the generated sourcemaps e.g server.mjs.map.
I couldn't find any relevant documentation in angular.dev, stackoverflow or anywhere else.. even ChatGPT took me on a wild goose chase which did not succeed.
Is it even possible to debug server.ts in an angular ssr project? If so, I would greatly appreciate some advice.
Minimal Reproduction
Exception or Error
No response
Your Environment
Anything else relevant?
I don't think it matters, but I'm using macOS 14.5, VS Code 1.89.1, npm 10.8.1.
The text was updated successfully, but these errors were encountered: