Skip to content
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

Improve docs on passing args to node process #648

Open
pellebjerkestrand opened this issue Dec 1, 2022 · 5 comments
Open

Improve docs on passing args to node process #648

pellebjerkestrand opened this issue Dec 1, 2022 · 5 comments

Comments

@pellebjerkestrand
Copy link

func start with -- "--prof" seems to do nothing. I, at least, can't find the resulting *.log file anywhere on my system.

Adding --prof to NODE_OPTIONS in local.settings.json results in an error message.

Relevant output snippet:

Azure Functions Core Tools
Core Tools Version:       4.0.4865 Commit hash: N/A  (64-bit)
Function Runtime Version: 4.12.2.19454

[2022-12-01T13:39:27.380Z] Language Worker Process exited. Pid=14562.
[2022-12-01T13:39:27.380Z] node exited with code 9 (0x9). .
[2022-12-01T13:39:27.390Z] node: --prof is not allowed in NODE_OPTIONS

Easy profiling of Node.js apps (https://nodejs.org/en/docs/guides/simple-profiling/) seems impossible, unless I'm missing something.

Please allow us to profile Node.js apps run with func start.

@ghost ghost added the Needs: Triage 🔍 label Dec 1, 2022
@pellebjerkestrand
Copy link
Author

Same behavior with the most recent version I can get from npm.

Azure Functions Core Tools
Core Tools Version:       4.0.4895 Commit hash: N/A  (64-bit)
Function Runtime Version: 4.13.0.19486

@ejizba
Copy link
Contributor

ejizba commented Dec 1, 2022

Hi @pellebjerkestrand the recommended way to modify the arguments to the node process is to use the languageWorkers__node__arguments setting. Here's at least one example in the docs: https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-node?tabs=v2-v3-v4-export%2Cv2-v3-v4-done%2Cv2%2Cv2-log-custom-telemetry%2Cv2-accessing-request-and-response%2Cwindows-setting-the-node-version#in-local-development-environment

@pellebjerkestrand
Copy link
Author

Hi @pellebjerkestrand the recommended way to modify the arguments to the node process is to use the languageWorkers__node__arguments setting. Here's at least one example in the docs: https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-node?tabs=v2-v3-v4-export%2Cv2-v3-v4-done%2Cv2%2Cv2-log-custom-telemetry%2Cv2-accessing-request-and-response%2Cwindows-setting-the-node-version#in-local-development-environment

Thanks a lot! That was not easy to find.

@ejizba ejizba transferred this issue from Azure/azure-functions-core-tools Dec 1, 2022
@ejizba
Copy link
Contributor

ejizba commented Dec 1, 2022

Yeah I agree it's a bit of a needle in a haystack and we've heard this feedback before. Moving the issue to the Node.js repo for follow up.

Do you have any suggestions of where you may have looked to find this information?

@ejizba ejizba changed the title Allow Node Profiling (--prof) Improve docs on passing args to node process Dec 1, 2022
@pellebjerkestrand
Copy link
Author

pellebjerkestrand commented Dec 1, 2022

It felt natural to me that passing arguments to the node process could be done on the command line, so I was looking in func start's documentation. I found nothing, so I searched for lots of different versions of "azure-functions-core-tools" + "pass argument to node" + "func start" and so on. I found plenty of blog posts and answers on Stack Overflow mentioning both -- "--prof" and using NODE_OPTIONS in local.settings.json with people writing that at least one of those worked for them.

If using --prof in NODE_OPTIONS gave a hint at what can be done instead (use languageWorkers__node__arguments), that would be great.

I still think it's more ergonomic to be able to pass these arguments on the command line when using func start since I rarely want profiling to stick around for long (and I guarantee I will forget that it's on and keep it longer than needed).

@ejizba ejizba modified the milestones: April 2023, Backlog Candidates Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants