Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Deploying web app with NodeServices to Azure #1177

Closed
jcmontx opened this issue Aug 8, 2017 · 7 comments
Closed

Deploying web app with NodeServices to Azure #1177

jcmontx opened this issue Aug 8, 2017 · 7 comments

Comments

@jcmontx
Copy link

jcmontx commented Aug 8, 2017

I'm trying to use NodeServices. Everything works just fine locally, but when I deploy (using Azure Continuous Delivery) doesn't work. I get this exception:

EDIT: I'm hosting in an Azure App Service.

   at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.<InvokeExportAsync>d__7`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.<InvokeExportAsync>d__13`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.<InvokeExportWithPossibleRetryAsync>d__10`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Autocosmos.Porter.Web.Controllers.InformacionUsuarioController.<DescargarDossier>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__27.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__25.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextResourceFilter>d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAsync>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Autocosmos.Porter.Web.Middlewares.ExceptionHandlerMiddleware.<Invoke>d__3.MoveNext()

This is my package.json:

{
  "name": "myappname",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "dependencies": {
    "jsreport-core": "^1.3.1",
    "jsreport-phantom-pdf": "^1.4.4",
    "jsreport-jsrender": "^1.0.2"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

I first thought it was that node packages weren't restoring correctly. So I configured it in the build process:

image

But that didn't fix it. What am I missing here?

Maybe I should commit my node_modules? That definitely doesn't feel right.

@jcmontx
Copy link
Author

jcmontx commented Aug 15, 2017

Anybody?

@hdesouky
Copy link

Did you found a solution?

@jcmontx
Copy link
Author

jcmontx commented Aug 21, 2017 via email

@theCuriousOne
Copy link

@jcmontx I managed to make a deploy on Azure VM server, but also needed node_modules to be copied. But strangely enough, locally on my machine I manage to have deployed site and run thru IIS7.

According to your error, I guess, you are missing NODEJS on the server where it is deployed. Remember that NodeJs is the one doing the JavaScript rendering.

@SteveSandersonMS
Copy link
Member

@jcmontx I also think this must be something to do with your jsreports packages. If you just create a new SPA app (e.g., dotnet new angular) and then deploy to Azure using Continuous Deployment, without changing any config settings at all, it will deploy and run correctly.

@theCuriousOne Azure runs ASP.NET Core apps in an environment where Node is available, so there isn't any problem with that for server-side prerendering.

Since I've verified that a clean new project deploys and runs correctly via Continuous Delivery, I'll mark this as closed. However, if anyone can repro a problem, could you please post a new issue with repro steps based on starting with a new project? Thanks.

@theCuriousOne
Copy link

Just to add for future reference (maybe someone has stumbled upon). Make sure that you have set the ASPNETCORE_ENVIRONMENT=Production otherwise the app will search for the webpack middleware for the hot-module reloading (and you do not need that on production). If you do not have access to the machine to set this, then I suggest added to the webconfig file if you deploy to IIS more details here

<environmentVariables> <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" /> </environmentVariables>

@gismountains
Copy link

see #1377

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants