Angular 2 web app in Azure returning system is not defined error - node.js

I am new to Angular2 and just published a very basic app to Azure web app. I searched before posting this question and found couple of references
http://abusanad.net/2016/07/24/publish-angular-2-app-from-visual-studio-to-azure/
Deploy Angular 2 App to Azure
After following the steps in these articles, I accessed my WebApp and I see errors in browser console with 404 not found files.
System.import('main.js').catch(function(err){ console.error(err); });
Image of Exception details attached here
I also checked the versions of npm(3.10.8) & nodejs(v6.9.1) in my webapp. Seems like its good.
Any help is appreciated ! Thanks.

After adding the engines version to package.json, the issue got fixed :)
"engines":{"node":6.9.1} (In my case, this is the version)
Link for reference on how to specify the engines version:
https://learn.microsoft.com/en-us/azure/nodejs-specify-node-version-azure-apps

It looks like your server can't find the external libraries that your website is referencing, such as System.js. The list of files in your screenshot seems to have been flattened out - the original directory structure of your node_modules folder has been lost. Did you perform some step which caused this? Did you run npm install in your wwwroot folder like the tutorial advised?
Looking a bit further in the future, you will want to investigate a build process for your front-end code using a tool such as Webpack or Rollup, to stop you from deploying tons of separate source files.
Edit: Just noticed that the directory in your screenshot is (probably) wwwroot/core-js/client. Can you show us wwwroot instead?

Related

Has anybody been able to successfully get an Express app running from Azure Functions?

I'm interested to see if anybody has managed this? If so, if they could point me to some boiler plate code?
I've tried running these packages:
https://www.npmjs.com/package/azure-function-express
https://www.npmjs.com/package/azure-function-express-2
https://www.npmjs.com/package/azure-aws-serverless-express
I've also tried running these with & without using the Serverless framework all without any success.
No routes that I've set up respond as expected and I'm unable to get any response from the server at all.
After several hours of testing I managed to get this working so I created this report / template to help others get started:
https://github.com/ytsruh/azurefunction-express-template
I'm still unable to get this working via the Serverless framework as the template (Serverless template, not the above repo) appears to not be updated to working with Azure Function Runtime v2.
The other things of note, is that the folder structure appears to be very important & opinionated. Eg the function/app must be inside a folder with the associated function.json file. I'll keep searching for a way to resolve this so it can follow a more 'standard' file structure for an ExpressJS app.

500 error when I try to deploy nextjs ssg application with incremental-static-generation

I have NextJS app with SSG. This functionality was added recently and according to it I should do next-export after next-build to get static files. But after appearing in 9.4 of Incremental Static Regeneration I need to keep server on by npm-start command (in my case I use custom server file with next-express functionality). It works good locally and It works good when I get artifact from Azure. But It doesn't work globally when it will be deployed finally. Help please
Through my attempts, I found that it is impossible to install globally or use next in Azure Web App. That is, it cannot be deployed through Github.Deploying using other methods such as FTP cannot run successfully. It should be related to the azure node environment.
But the method provided in this post says that it can be processed by adding web.config. I think it should be useful and helpful to you. Please read it carefully and try it.
You also can read this document, maybe it useful to you.

Deployed Nodejs service does not work on Azure Web App

I've created two pipelines: build and release for Nodejs app.
Here is the link to nodejs app repo: azure web service
Here is the tasks for build pipeline:
Here is the wwwroot folder structure:
So it is look like all required files are present.
Despite that, I'm constantly receiving:
You do not have permission to view this directory or page
I've tried to add web.config file, but it did not help.
I have front end application on same App service Plan and it works, so it is no way that I have bad service plan.
Do you have any suggestions?
Thanks a lot.
I was able to deploy my service only after using nodejs-docs-hello-world starter.
It is looks like web.config is a required file, btw, still did not find any meaningfull documentation for web.config.
Make sure your azure nodejs env support your js syntax (import from ...), in other case use webpack or typescript.
I'have found App Service Editor very helpful if you want to debug your code errors. See section Output.
I had a problem also with nodejs version, despite the fact I choosed node 12 tls during web app creation, I have noticed that my app used node 6 under the hood. So I changed default nodejs version to 10. See here how to do it
Also, I want to thank #Jason Pan for his help.

Reactjs with Azure

I have a problem, i have created webApp, using Nodejs 8.1, its operational. I uploaded my code using a zip file. I ran npm install and start (to test) in the kudu,cmd debug console, they both succeed. It's not a reactjs .Net application (not my choice ..). I still can't see my website, I have tested different web.config files,obviously not using then locally. Should I use a VM... I need ideas. I can go thru the directories if directoryBrowse enabled = True. So there is some kind of response ...
Oh boy I was sooo far off, I needed to build and upload the build.. I found the answer here. Here is the answer

Missing Documentation for web.config for a Node.js application on Azure Website

I'm running a Node.js server as API for my mobile app on a Windows Azure Website. And I'm having some trouble with it due to the needed web.config - but I couldn't find any really helpful documentation about it. Everything I can find is googling for specific problems on it and with a bit luck I can use the config snippets.
is there any general documentation about the contents the web.config can contain and their meaning?
in the start I had the problem that errors were modified by IIS to a general error. But since it's a REST API I want the HTTP status codes to be returned. I got around that with the <httpErrors existingResponse="PassThrough" /> element, but it doesn't seem to work for every error.
The only documentation I found so far are example configuration files of the iisnode module.
If you see the following error:
web.config not found in project, to create a project to deploy to
Windows Azure you must create a Windows Azure Node.js project.
....you may have created the wrong type of Visual Studio Project. You want a "Windows Azure Node.js Application" not a "Node.js Web Application". The former creates a few extra files that are needed for Azure (Web.cloud.config & Web.config).
You may be able to create a dummy VS project of the correct type and then copy these files into your existing project. Alternatively create a new project of the correct type and copy your source files into the new project.
Create Azure Basic Node.js Express Application

Resources