Depreciation warning does not allow deploying an Application on AZURE, - node.js

I get the following warning while deploying my application to AZURE.
(node:6568) [DEP0064] DeprecationWarning: tls.createSecurePair() is
deprecated. Please use tls.Socket instead.
But this does not allow my application to start. Azure logs show the following thing:
PATH OF LOGS: D:\home\LogFiles\Application>

I know this question is already 8 month old, but just for completeness I am going to provide the answer on how to suppress warnings for Node in Azure. There is actually multiple ways:
Using iisnode.yml
Just put the following line in the iisnode.yml:
nodeProcessCommandLine: node.exe --no-deprecation --no-warnings
Or if you use a full path to a version of Node, you'll need to quote it, e.g.
nodeProcessCommandLine: "D:\Program Files (x86)\nodejs\10.6.0\node.exe" --no-deprecation --no-warnings
Using web.config
Toward the end of the file, you'll see a commented out tag. Replace it by something like this:
<iisnode nodeProcessCommandLine="node.exe --no-deprecation --no-warnings"/>
Notes
iisnode.yml takes precedence over web.config
See the original post on how to add runtime flags in Azure here: Pass flags to NodeJS's Chrome V8 engine in Azure Web Apps

Related

Azure App Service: node version in package.json do not work

in my node js web app, i use node version = 6.9.1:
"engines": {
"node": "6.9.1"
}
and when i do deployment with
git push azure master
it shows correct node is used.
...
remote: Selected node.js version 6.9.1. Use package.json file to choose a different version.
remote: Selected npm version 3.10.8
...
but my app service is not started correctly because of node.exe crashed.
later i output the used node version number in my entry point script, i get
Node version:v0.6.20
from file D:\home\LogFiles\Application\xxxx-stdout-xxxx.txt
so obviously Azure App service is not using my defined version of node.exe.
later i follow https://learn.microsoft.com/en-us/azure/nodejs-specify-node-version-azure-apps
add below text in file D:\home\site\wwwroot\iisnode.yml to fix this issue.
nodeProcessCommandLine: "D:\Program Files (x86)\nodejs\6.9.1\node.exe"
so my question is why Azure App Service (iisnode) is not using my defined node version in package.json ?
To change the NodeJs version of Azure App Service by using iisnode.yml(which won’t change node version on kudu cli or during deployment), you need to set iisnode.yml file manually in your app root folder with including below line as you have mentioned:
nodeProcessCommandLine: "D:\Program Files (x86)\nodejs\5.9.1\node.exe"
Then you need to set iisnode.yml file using package.json during source control deployment.
Azure Source Control deployment process would involve below steps
1. Moves content to azure web app
2. Creates default deployment script, if there isn’t one(deploy.cmd, .deployment files) in web app root folder
3. Run’s deployment script where it creates iisnode.yml file if you mention nodejs version in package.json file > engine
Reference: https://blogs.msdn.microsoft.com/azureossds/2016/04/20/nodejs-and-npm-versions-on-azure-app-services/.
Or else you can use App Settings in Azure portal to change the version of NodeJs.

Upgrading Node on an Azure website?

I'm trying to run some pre deployment tasks (unit tests etc) with NPM on an Azure website, however the version of node on the VM is v0.10.32, the current version of node is v4.2.4.
I have non administrative access to the command line via the SCM website, no RDP etc.
Is there any way to upgrade?
Ensure the Azure Web App has the node version you want.
Go to yoursite.scm.azurewebsites.net
Choose Debug Console (PowerShell or CMD)
Navigate to D:\Program Files (x86)\nodejs
Run dir to see the available nodejs versions.
For instance, if there is a directory named 6.3.0, then you can use it.
// App Setting
WEBSITE_NODE_DEFAULT_VERSION 6.3.0
// package.json
engines":{"node": "6.3.0"}
You can specify the version of node that the app is running on using the package.json file. Add:
"engines":{"node":version}
e.g.:
"engines":{"node": "0.12.x"},
More info: https://azure.microsoft.com/en-us/documentation/articles/nodejs-specify-node-version-azure-apps/
2017 update. All above didn't work for me in.
I changed:
// package.json
engines":{"node": "8.0.0"}
and then I added app settings value
<appSettings>
<add key="WEBSITE_NODE_DEFAULT_VERSION" value="8.0.0" />
</appSettings>
I restarted an app million times, and the solution was to change iisnode.yml
nodeProcessCommandLine: "D:\Program Files (x86)\nodejs\8.0.0\node.exe"
That's it. I hope it will help someone.
Update
Just to clarify things: I'm talking about App Service
And if you ftp to your App you will see iisnode.yml here:
Changing NodeJs Version in Azure Portal
Navigate to your web app in azure portal
Click on Application settings in Settings blade.
You can include WEBSITE_NODE_DEFAULT_VERSION as key and version of nodejs you want as value in app settings.
Example: WEBSITE_NODE_DEFAULT_VERSION 8.0.0
For me, the solution was neither to set the engine version in package.json, nor to set WEBSITE_NODE_DEFAULT_VERSION, but to use the az command line as described here:
az webapp config set \
--resource-group <resource-group-name> \
--name <app-name> \
--linux-fx-version "NODE|14-lts"

Kibana 4 configuration for production

I'm trying to deploy Kibana 4 to Azure Websites. I can't use bin/kibanta.bat file since Azure Websites uses start script in package.json to bootstrap application. I tried to update package.json start script to run bin\kibana.js file and environment variables in it. After that Azure starts running Kibana server but I'm getting this error: Uncaught ReferenceError: ZeroClipboard is not defined (http://kibana-site.azurewebsites.net/index.js?_b=5827:89458). Does anyone tried to make Kibana 4 run not using bin\kibana* files? Maybe I have to specify additional environment variables?
The solution is explained here: https://github.com/elastic/kibana/issues/2617
It's a bug that was fixed later.

Using RequireJS in an Azure deployment file

We have been using RequireJS Optimizer in our deployment file for months now. Everything was working.
Basically what we are doing is the following:
We compile our Coffee scripts files
node %DEPLOYMENT_SOURCE%\build\node_modules\coffee-script\bin\coffee -co "%DEPLOYMENT_SOURCE%\src\Web\Scripts" "%DEPLOYMENT_SOURCE%\src\Web\Coffee"
Then we opitmize the js files into a single file using RequireJS:
node "%DEPLOYMENT_SOURCE%\build\node_modules\requirejs\bin\r.js" -o "%DEPLOYMENT_SOURCE%\build\build.js"
Locally, it works #1. But on Azure we have this error:
Cannot optimize network URL, skipping: //1.1.1.1.1/path/site/repository/src/Web/Scripts/dashboard/almond.js
Please note that I changed the IP and the paths.
I checked the documentation of RequireJS, and in fact it does not support network URLs when optimizing.
The same script was working a few days ago.
Anybody aware of changes in Azure that could have lead to this? Any workaround?
Thanks a lot
I made it working by overriding the baseUrl when calling r.js:
node "%DEPLOYMENT_SOURCE%\build\node_modules\requirejs\bin\r.js" -o "%DEPLOYMENT_SOURCE%\build\build.js" baseUrl=%DEPLOYMENT_SOURCE%\src\Web\scripts

Can't get azure web role to run locally using the emulator

I have a web role that I'm trying to run locally using the emulator. I have it working on another computer, but I cannot get it working on a different one, and have gone as far as to reformat it and start from scratch.
When I launch the site from Visual Studio, Chrome shows the following message:
This webpage is not available
The connection to 127.0.0.1 was interrupted.
There is also an error code listed at the bottom:
Error 101 (net::ERR_CONNECTION_RESET): The connection was reset.
One interesting thing from the build output are these lines:
Starting process 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Windows Azure Tools\v1.8\Debugger\WindowsAzureDebugger.exe' with arguments '"C:\Program Files\IIS Express\iisexpress.exe" /trace:error /config:"C:\Users\brian\AppData\Local\dftmp\Resources\159c7254-b7d0-4076-a4fd-820b00feca5f\temp\temp\RoleTemp\applicationHost.config" /site:"deployment18(27).AzureApp.MyApp.Web_IN_0_Web"'...
Process 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Windows Azure Tools\v1.8\Debugger\WindowsAzureDebugger.exe' exited with exit code 0.
If I run C:\Program Files\IIS Express\iisexpress.exe" /trace:error /config:"C:\Users\brian\AppData\Local\dftmp\Resources\159c7254-b7d0-4076-a4fd-820b00feca5f\temp\temp\RoleTemp\applicationHost.config" /site:"deployment18(27).AzureApp.MyApp.Web_IN_0_Web" from the command line, I get the following message:
The system cannot find the file specified.
Unable to start IIS Express in background.
I have no idea what file it cannot find, but I've verified that the config file I'm passing does in fact exist. Anyone have a clue what's going on here??
While I can not tell you what could be the actual root cause of your problem I can suggest a few ways to troubleshoot it:
Try changing IIS Express to Full IIS and see if it changes the behavior. You can do it by going to your Windows Azure Application project properties and look at "Web" option.
Try running application without debugging it
Launch CSrun at command prompt with /launchDebugger parameter of the /run option to verify that debugger does run without any issue
Try using IE as default browser
Clean your dftemp folder completely for any residual configuration and then launch Azure Emulator separately to verify there are no issues
Procmon "http://technet.microsoft.com/en-us/sysinternals/bb896645" may help you find the file that is missing...
Hopefully someone stumbles upon this answer with similar symptoms. When removing in role caching the <dataCacheClients> section was removed from . Somehow there was a left over <dataCacheClients> section left in the web.config. Everything and compiled and deployed to the emulator successfully. However, the role would fail to start since applicationHost.config was missing.
The fix was simply remove the unnecessary <dataCacheClients> section from the web.config file.

Resources