Kush Grover
Kush Grover

Reputation: 373

Getting Node invocation timed out error when invoking JS file using Microsoft.AspNetCore.NodeServices

Title Getting Node invocation timed out error when invoking JS file using Microsoft.AspNetCore.NodeServices

Functional impact I developed application which is using NodeServices and deployed it on Azure using following article: https://code.msdn.microsoft.com/How-to-export-HTML-to-PDF-c5afd0ce

It's working locally, but not on deployed version. Getting node time out error:

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

Expected result PDF should be created.

Actual result NodeService throwing timeout error

But still getting Timeout error on deployed version. Any help would be appreciated. Thanks.

Upvotes: 2

Views: 1250

Answers (2)

Sam
Sam

Reputation: 1368

You can specify a timeout when adding NodeServices to the service container - You can also set an ILogger there which might help you debug the problem :

services.AddNodeServices(options =>
{
    options.InvocationTimeoutMilliseconds = TimeSpan.FromMinutes(5).Milliseconds;
    options.NodeInstanceOutputLogger = log;

});

Upvotes: 5

galdin
galdin

Reputation: 14074

PhantomJS is not supported on Azure Web App. More information here.
I ended up using Azure Web App for Containers.

Here's my blogpost on how to do it in ASP.NET Core using NodeServices on docker: Link.
(It uses another node package though).

Upvotes: 1

Related Questions