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 #1377

Closed
gismountains opened this issue Nov 7, 2017 · 8 comments
Closed

Deploying web app with NodeServices to Azure #1377

gismountains opened this issue Nov 7, 2017 · 8 comments

Comments

@gismountains
Copy link

I'm trying to deploy the following application on Azure Web App with NodeServices:
https://code.msdn.microsoft.com/How-to-export-HTML-to-PDF-c5afd0ce

It works great localy, but it do not work on the Azure Web App.

I also started a new project and followed the steps. It also works locally but not in Azure.
Azure Insights tells:
Cannot find module 'D:\home\site\wwwroot\pdf'
Error: Cannot find module 'D:\home\site\wwwroot\pdf' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at D:\local\Temp\aoh0wv2g.nxy:109:34 at IncomingMessage. (D:\local\Temp\aoh0wv2g.nxy:133:38) at emitNone (events.js:86:13) at IncomingMessage.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:74:11)

But I do not know what to do. Some suggestion?

@SteveSandersonMS
Copy link
Member

This error:

Cannot find module 'D:\home\site\wwwroot\pdf'

... implies that it's looking for a file at wwwroot\pdf.js, but no such file was found. Make sure you're deploying that file to Azure correctly.

Also it's quite strange to put that file under wwwroot, because wwwroot is the folder from which files are publicly servable, but you don't need to serve pdf.js if it's only used on the server. I'd recommend moving the file outside wwwroot, for example to the project root, and update your nodeServices.InvokeAsync call to reference it at that location.

@gismountains
Copy link
Author

Thank you for the fast response.
I tried to move this file to wwwroot with no effect. and I moved back:
image

And I do not see how I need to change the nodeServices.InvokeAsync because it works locally?!?

@SteveSandersonMS
Copy link
Member

It's possible then that the pdf.js file isn't getting deployed at all. You may need to check your deployment configuration. If you're deploying to Azure, you can use the Console tool built into the management portal to see exactly what files were deployed to server (by running dir or other command-line commands).

@gismountains
Copy link
Author

gismountains commented Nov 8, 2017

Thank you again. The first problem was with deployment. It was necessary to set "copy always" in the properties. The second problem was about the name. It needs the whole name with ".js".

And now there is the next problem:

Cannot find module 'jsreport-core'
Error: Cannot find module 'jsreport-core' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at module.exports (D:\home\site\wwwroot\pdf.js:2:44) at D:\local\Temp\llr222tl.f3s:114:19 at IncomingMessage. (D:\local\Temp\llr222tl.f3s:133:38) at emitNone (events.js:86:13) at IncomingMessage.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12)

What could be the reason that the node.js-module is not intsalled?

@i-love-to-code
Copy link

i-love-to-code commented Nov 10, 2017

@gismountains having just solved this very problem, your node_modules folder is most likely not being deployed. In my build script, I run xcopy to copy the node_modules folder to the publish directory, after running dotnet publish.

Edit: Fixed a typo

@arupbaroi
Copy link

I am also facing the same issue. Is it resolved ? If yes can any one tell me how it is resolved?

@SteveSandersonMS
Copy link
Member

@arupbaroi There isn't anything to resolve; it's been working all along :) If you think you've found a problem, could you post repro steps (as a new issue)?

@kgrvr
Copy link

kgrvr commented May 7, 2018

@SteveSandersonMS I faced the same problems mentioned above. After resolving those, now I'm stuck with following error:

Name: NodeInvocationException
Message: The Node invocation timed out after 60000ms.
You can change the timeout duration by setting the InvocationTimeoutMilliseconds property on NodeServicesOptions.

The first debugging step is to ensure that your Node.js function always invokes the supplied callback (or throws an exception synchronously), even if it encounters an error. Otherwise, the .NET code has no way to know that it is finished or has failed. | Source: Microsoft.AspNetCore.NodeServices

Any help would be appreciated.

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