question

69673825 avatar image
0 Votes"
69673825 asked ajkuma-MSFT answered

Azure and Node JS and pop up messages

I am using Node JS with Azure.
Locally I can use the alert function to display helpful short messages.
Once uploaded to Azure the alert function no longer works.
Is there any way around this or do I just have to code with out pop ups ?

azure-webapps
· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@69673825 Can you please confirm if you have deployed your application in azure function/azure web app or any other azure service so I can add the right tag so the right team can assist you further.

0 Votes 0 ·

Its an Azure web app.

0 Votes 0 ·

@69673825 Thanks for the confirmation. I have added the right tags so the team can assist you.

0 Votes 0 ·

Adding to above: Is this Windows or Linux App Service. Please see this doc:
Best Practices for Azure App Service - Node.js and outgoing http requests


0 Votes 0 ·

@69673825,

To better assist you on this, when you say 'once uploaded to Azure the alert function no longer works', are you referring to specific function (alert) on your site not working? Could you please elaborate more on this? Please do share a screenshot of the issue after concealing any private info.

To begin with, you may capture a fiddler/network trace to see if it provides more info.

Kindly check this doc which outlines best practices for provisioning Node.js WebApp on Azure App Service.
Best practices and troubleshooting guide for node applications on Azure App Service Windows

Also, checkout the Azure diagnostic blade. To do this, navigate to your Azure WebApp in the Azure portal and select 'Diagnose and solve problems' to open the diagnostics and go over the diagnostic options.

As a best practices on App Service:

When working with Node.js and many outgoing http requests, dealing with HTTP - Keep-Alive is important. You can use the agentkeepalive npm package to make it easier in your code.

Always handle the http response, even if you do nothing in the handler. If you don't handle the response properly, your application gets stuck eventually because no more sockets are available.

For example, when working with the http or https package:

 const request = https.request(options, function(response) {
     response.on('data', function() { /* do nothing */ });
 });


0 Votes 0 ·

I can run alert fine locally on my pc using localhost.
Once the function is uploaded to Azure it no longer works.
Same goes for AWS.

I can only assume that online you cant do client side pop ups ?

0 Votes 0 ·

1 Answer

ajkuma-MSFT avatar image
0 Votes"
ajkuma-MSFT answered

69673825, Apologies for the delay in responding from over the weekend.

I think you mean nodejs server side. In case of server side you can’t have pop ups, you could write to the console with console.log(), console.error() or console.warn() functions.

Those logs could also be redirected from the stdout to the Azure App Service Log Stream, to Blob Storage or to Log Analytics workspace.

If you still have questions, kindly do provide some more details about your setup/scenario so we can better assist you.




5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.