The azure-functions-cli offers a way to kickoff debugging, but these instructions seem to be Visual Studio specific.
I tried using a similar trick to serverless by setting up a run config in WebStorm to point the JavaScript file to:
\node_modules\azure-functions-cli\lib\main.js
And then passing the Application args:
run myFunctionName --debug
This successfully runs the functions with Azure's tools, but both WebStorm tries to set a debugging port; and when the Azure window opens up it sets its own debugging port.
From Webstorm:
C:\Program Files (x86)\JetBrains\WebStorm 2016.2.3\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" --debug-brk=60168 --expose_debug_as=v8debug C:\Users\username\AppData\Roaming\npm\node_modules\azure-functions-cli\lib\main.js run myfunction --debug
Debugger listening on [::]:60168
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException:
Likewise, Azure-cli says it opens a debugging port, but they do not match.
As a result, breakpoints set are ignored when the functions are called (Though it does successfully run).
Anybody know how to configure this properly to be able to use WebStorm to debug?
Azure-Functions-CLI was renamed to azure-functions-core-tools. If you still have the Azure-Functions-CLI see my legacy response at the end of this post.
If you're running the new azure-functions-core-tools it looks like they broke the capability to run a remote debugger :-(.
I have the following issue opened and I will update if they tell me otherwise:
https://github.com/Azure/azure-functions-core-tools/issues/378
Fortunately, the new Beta version of the azure-functions-core tools doesn't have all of this C# craziness that prevents it from running on other OSes and requires a remote debugger. To install that version, you can use:
npm i -g azure-functions-core-tools#core
With that version installed, you can launch things with the good 'ol standard Node runtime.
Within WebStorm from Run -> Edit Configurations create a new "Node.JS".
Give the debugging some type of name.
Set the JavaScript file to:
~\AppData\Roaming\npm\node_modules\azure-functions-core-tools\lib\main.js
NOTE: The above assume you installed Azure Functions on a Windows machine with the global flag.
Set the Application Parameters to: start --debug VSCODE
Edit the file ".vscode\launch.json" and change the debug port to 9229 for node.
Within WebStorm choose Run-> Debug:"What_You_Named_the_Remote_Profile"
Add some breakpoints.
Navigate to your API end-point and see that the break-points work.
NOTE: By default it appears the function will be at http://localhost:7071/api/functionName
------------------- EDITED But Below Held for Posterity --------------
Okay, it looks like you can not do this with local debugging, but can with "Remote Debugging" within WebStorm.
Within WebStorm from Run -> Edit Configurations create a new "Node.JS Remote Debug".
Give the debugging some type of name.
Hit the + Sign where it says, "Before Launch: External Tool" and choose "Run External Tool".
Hit the + Sign again and fill it out like the screen-shot (This is assuming you installed the Azure Function CLI globally).
NOTE: The above screenshot has been updated based on the latest version of Azure Functions CLI/. Earlier versions required you to state an app name, and did not require --debug to debug. As a result if you are not updated to the latest version of Azure Functions CLI (now known as Azure-Functions-Core-Tools) you may need to have "run MyApp" in the Parameters field.
Within WebStorm choose Run-> Debug:"What_You_Named_the_Remote_Profile"
Add some breakpoints.
Navigate to your API end-point and see that the break-points work.
NOTE: By default it appears the function will be at http://localhost:7071/api/functionName
Add this to your local.setting.json file under values: "languageWorkers:node:arguments": "--inspect=5858"
Click Edit configuration. Click the plus icon and choose Attachto Node.js/Chrome
Fill in these values for the options: host: localhost - Port: 5858 and set Attac to option to "Crhome or Nod.js>6.3 started with --inpect"
Start the function and run the debugger
See this picture: https://i.stack.imgur.com/hnC74.png
Related
After installing ionic and android sdk one windows, I tried to build a sample app running the command ionic build android.
It so happens that after running this command, and after some seconds the following message appears:
Usage: java [-options] class [args...]
(to execute a class) or java [-options] -jar jarfile [args...]
(to execute a jar file) where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
The default VM is server.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose:[class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
Warning: this feature is deprecated and will be removed
in a future release.
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
Warning: this feature is deprecated and will be removed
in a future release.
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image See http://www.oracle.com/technetwork/java/javase/documentation/index.html
for more details.
Error: cmd: Command failed with exit code 1
For this error I tried to reinstall java JDK7 and also installed JAVA8, and also I switched node version (tried node 8 and 6) , but nothing has worked. Because this error is so generic, I am having difficulties knowing what should I look for.
I'm also running windows 7.
Can anyone help me with this?
I am experiencing different behaviour when using Chromium's --enable-logging flag as part of a NW.js application. On a Windows 10 machine, specifying the logging flag as part of the package.json "chromium-args": "--enable-logging --v=1" spawns two extra prompt windows in addition to the main window.
Searching the Chromium documentation suggested adding the --no-sandbox flag would solve this issue. Adding it to the package.json file did not change the behaviour.
However, providing the logging flag through the command line and not in the package.json file yields the desired result.
"App Name.exe" --enable-logging --v=1
The log file is generated as expected and no extra windows are spawned on launch. Why is there a difference when I specify the argument on the command line vs. in the chromium-args section of the package.json file? And secondly, how can I get the desired behaviour by specifying everything in the package?
Using NW.js version 0.16.1
I have gone through the instruction found on Parse.com to setup Cloud code. I downloaded exe file as instructed in 1. It seems like there is a step missing before step 2.
When i run "parse new" in the command prompt i get "not recognized as an internal or external command". What am i missing? How do i install/use cloud code?
Get the Parse tool
The Parse command line tool for Windows is available here. Download
the Windows executable named: parse.exe at this link. Note that this
is not an installer, it is just a plain Windows executable.
Set up a Cloud Code directory.
From the Command Prompt, run the command parse new and follow
instructions. In this quickstart we'll see how to set up your server
code on Heroku. Please read docs for more details.
I just downloaded the parse CLI on my Windows desktop to figure it out and I believe I've found your solution.
You need to open up a standard command line on windows and then navigate to where you have stored parse.exe. Once the command line is at the same directory as the exe, you will be able to run parse new and any of the other CLI commands.
For example, you could do the following:
Hit the Windows key (or start menu) and search "cmd" then hit enter to open the command line
Navigate to where parse.exe is located. If it's on your desktop, it could be something along the lines of cd C:\Users\<name>\Desktop
parse help, parse new and so on should now work from this directory
The documentation feels a bit vague and could use some clarification for the Windows platform. Hope this helps!
My general problem is how to run unit tests with karma in IE or other browser installed on a Windows machine, while karma is run on a Linux machine, though in the question below I might ask more specific question based on what I've already tried.
Also it may be worth to mention, that I have Windows installed on a Virtual box machine.
I started karma from a terminal, then opened in IE this url: http://10.0.2.2:9876 and saw the karma page in the browser window (though I spotted some quick blink with a red background, I suppose it is related to an error I'll mention further).
After that I tried to run tests with the command: node_modules/karma/bin/karma run config.js in another terminal tab. When I did this I got this error (I get it even when I use Chrome on my Linux host-machine instead IE on the Virtual box guest, so I suppose the error has nothing to do with networking):
You need to include some adapter that implements __karma__.start method!
I googled for this error and found another question: Error: You need to include some adapter that implements __karma__.start method
Supposing that I need to run tests from the same place I started karma-server I tried to redirect the output to another tab:
$node_modules/karma/bin/karma start &> /dev/pts/17 &
$node_modules/karma/bin/karma run config.js
But this did not help. If I try to start server and run tests in a single command, then I do not have time to register IE.
So could anyone please answer any of the next questions:
how to run unit tests with karma in a browser on other machine?
how to get rid of this error You need to include some adapter that implements __karma__.start method!, if the karma server was started in one terminal tab and the run command was issued in another?
how to start the karma server and run tests in separate steps, i.e. issue the karma start and karma run config.js commands instead of karma start config.js?
My regards and sincerest appreciation in advance for any help.
Currently I've found a workaround for this. I start karma with the config file:
karma start config.js
in the config I have singleRun: false.
Then I manually connect my IE instance, and after this I run the tests from another terminal tab. Why this happens I have no idea. The only inconvenience is that I always have browsers' windows open.
I have moved an existing node.js + express project to VS because I prefer the IDE over JetBrains for now (used VS for years, only peeked into Webstorm).
I used NTVS new project->from existing sources and all files were imported successfully.
Afterwards, I opened the project settings of my project and set the node.exe arguments to bin\www, startup file for express.
When I press F5 (debug) I get the console.log messages I have put into the www and app.js files in the opening command prompt, and it looks like the server is running (cannot confirm, I want to debug if everything is working), but the VS debugger directly exits again, it also does not open any page in the browser I selected for debugging.
My node app actually is a REST webservice, so I want to test different URLs with different parameters.
Also, I cannot access the app on the port I specified, though when I directly start it from node.exe I can, even though the command prompt is still open.
(I have NTVS and WebEssentials installed - some operations take a long long time, but I attribute this to NTVS being still an early version.)
Question: how does the Visual Studio debugger stay connected to the node.js application so I can use breakpoints and use any browser then to connect and test different URLs? (Even a breakpoint put on the console.log that gets printed during startup is not being triggered.)
For everyone who asks receives, and the one who searches finds....
(and yes, I did spend a long time searching and trying before posting here..)
Kind of nice to debug node.js server with VS..
hope this helps someone
Edit: The arguments to node.exe can be hard to read in the image. It must be
--debug=<portno>
that is with two dashes (and not just one) to specify the debug port.
Not so much knowledge on expressjs but with a recent release of NTVS 1.0 Alpha, I did find it supports remote debugging which can be also used to debug nodejs app running locally - anyway haven't tried if it works with nodejs app + expressjs but it should.
I followed the step in this video https://youtu.be/-ir9ZB8lUg4 which is
Run your nodejs with node.exe RemoteDebug.js <your_javascript_file>.
RemoteDebug.js has come when you install NTVS.
In Visual Studio, select Debug > Attach to Process
Select Node.js remote debugging for Transport
Enter localhost:5859 for Qualifier
Click Attach
This will put Visual Studio in debugging mode which you can set a breakpoint, do step-in/step-out, very same experience when you use VS to debug .NET app.
Its pretty straight forward with NTVS, you can download required version for your windows from github here
Once you install NTVS, NodeJS project templates will be added
Now, Goto File->New project -> Basic NodeJS Express 3 application (it will be available in javascript project templates)
Now just goto debug and select Start Debugging, add breakpoints where ever required and you can start debugging