question

ZakariaKHORF-5552 avatar image
0 Votes"
ZakariaKHORF-5552 asked ajkuma-MSFT answered

An .Exe running in Azure app service causes problems

When a Node.js module runs a .exe on my linux azure app service file this bug appears :

Error: spawn /node_modules/mso-pdf/mso-pdf.exe EACCES
2021-09-01T15:45:31.299726157Z at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
2021-09-01T15:45:31.299731257Z at onErrorNT (internal/child_process.js:465:16)
2021-09-01T15:45:31.299736257Z at processTicksAndRejections (internal/process/task_queues.js:80:21)
2021-09-01T15:45:31.299741057Z Emitted 'error' event on ChildProcess instance at:
2021-09-01T15:45:31.299746058Z at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
2021-09-01T15:45:31.299763558Z at onErrorNT (internal/child_process.js:465:16)
2021-09-01T15:45:31.299768459Z at processTicksAndRejections (internal/process/task_queues.js:80:21) {
2021-09-01T15:45:31.299773059Z errno: -13,
2021-09-01T15:45:31.299777759Z code: 'EACCES',
2021-09-01T15:45:31.299782259Z syscall: 'spawn /node_modules/mso-pdf/mso-pdf.exe',
2021-09-01T15:45:31.299786859Z path: '/node_modules/mso-pdf/mso-pdf.exe',
2021-09-01T15:45:31.299814961Z spawnargs: [
2021-09-01T15:45:31.299820261Z 'WD',
2021-09-01T15:45:31.299824561Z '/home/site/wwwroot/dist/output.docx',
2021-09-01T15:45:31.299828861Z '/home/site/wwwroot/dist/output.pdf'
2021-09-01T15:45:31.299845662Z ]
2021-09-01T15:45:31.299849962Z }

I think it is a permissions problem, any ideas ?

Thanks

azure-webapps
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.

1 Answer

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

@ZakariaKHORF-5552, Thanks for posting a good question.

All Azure Web Apps run in a secure environment called a sandbox. Each app runs inside its own sandbox, isolating its execution from other instances on the same machine.
At first glimpse, the error appears be caused due to sandbox restrictions.

-Azure WebApps Sandbox -See 'general sandbox restrictions' and 'PDF generation from HTML' sections.
Operating system functionality on Azure App Service -Linux apps in App Service run in their own containers

If your requirement fits, you can leverage custom container
Configure a custom container for Azure App Service
Customize build automation

Azure App Service understands package.json and npm-shrinkwrap.json files and can install modules based on entries in these files.
Using Node.js Modules with Azure applications

Kindly let us know, I'll follow-up with you further.


· 3
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.

Hello ajkuma and thank you for your response,

Working with a custom container might work yes . I tried to work with a startup script for when the container loads and i did the following :

Gave the .exe app of the mso-nodejs module all permissions which removed the errors but the pdf file is not generated (The app is developed in VB could it be the cause ? )

Tried to work with modules that require Libreofiice (when installing manually via kudu it works ) but when i added the installation on the script the installation failed due to installation time (even tho i added the WEBSITES_CONTAINER_START_TIME_LIMIT variable and set it to 1800secs it gives more time but still fails due to time (it does not reach 1800 seconds))

Now i am considering either modifiying the container or putting the pdf conversion in a service of its own .

Thanks in advance

0 Votes 0 ·

After re running the startup script i no longer get timed out but i get this error :
2021-09-03T12:29:58.903Z ERROR - Container healthbotoutput_0_c87528ec for site healthbotoutput has exited, failing site start
2021-09-03T12:29:58.982Z ERROR - Container healthbotoutput_0_c87528ec didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.

Any idea why the container ping is not working on the 8080 port ?

0 Votes 0 ·

ZakariaKHORF-5552, Apologies for the delay in responding from over the weekend.

Thanks for sharing additional details and things that you'd tried.

The default port will be 8080 for NodeJS apps, if there is a PORT app setting or env variable it will take that value.

You may review the log file log file via Kudu – to identify the port it’s currently listening on:
Kudu site- https://yourwebapp.scm.azurewebsites.net/
Example : it could read ready - started server on http://localhost:3000

  • specify a port to listen to (process.env.PORT)

  • You can add the app setting in the portal with PORT=3000


Since GAC (Global Assembly Cache) isn't supported. You may consider copying required assemblies to the app's \bin folder. Also custom .msi files installed on the server (for example, PDF generators) cannot be used. -- You may test to see if your setup/package works locally.

Just to highlight a few more points:

-Note that installing packages globally is unsupported, whether requested directly by your app or by some pre/post install script of an included package.
For example, this will not work in your package.json:

-It will depend on the node scripts define above that Oryx will generate a startup script and use PM2 as default.
-If you set npm start in package.json, the startup script will be using npm start instead of PM2.

For more information on how App Service runs and builds Node.js apps in Linux, see Oryx documentation: How Node.js apps are detected and built.




0 Votes 0 ·