node.jslinuxazureazure-webjobs

Linux Azure Webjob in nodejs referring to node.exe


I tried to switch to preview Azure App Service Webjobs running on linux for nodejs continuous webjob without luck. (I have deep successful experiences on nodejs/C# ones on AppService Webjobs running on windows).

The beginning is promising, but for unclear reason, the error message refers to node.exe

[09/24/2024 19:24:02 > 6843e9: SYS INFO] WebJob singleton lock is acquired
[09/24/2024 19:24:02 > 6843e9: SYS INFO] Run script 'run.js' with script host - 'NodeScriptHost'
[09/24/2024 19:24:02 > 6843e9: SYS INFO] Status changed to Running
[09/24/2024 19:24:02 > 6843e9: ERR ] An error occurred trying to start process 'node.exe' with working directory '/home/site/wwwroot/App_Data/jobs/continuous/test3'. No such file or directory
[09/24/2024 19:24:02 > 6843e9: SYS ERR ] System.AggregateException: One or more errors occurred. (An error occurred trying to start process 'node.exe' with working directory '/home/site/wwwroot/App_Data/jobs/continuous/test3'. No such file or directory)
 ---> System.ComponentModel.Win32Exception (2): An error occurred trying to start process 'node.exe' with working directory '/home/site/wwwroot/App_Data/jobs/continuous/test3'. No such file or directory
   at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)

Tried to play with an extra "script.sh" inspired from this site with no success.

https://techcommunity.microsoft.com/t5/apps-on-azure-blog/create-and-deploy-linux-webjobs-on-azure-app-service/ba-p/4218587

#!/bin/bash
node run.js

stack correctly on nodejs 20 enabled SCM Basic Auth app service settings

worth noting, the script runs fine if directly instancied from ssh within the appservice (xxxxx.scm.azurewebsites.net/newui/webssh) ssh

Tried deployment via

  1. ftp
  2. zip deployment
  3. directly playing through ssh/vi/etc

run.js (simplied a bit ;))

console.log("I'm alive");

script.sh

#!/bin/bash
/opt/node-wrapper/node run.js

Solution

  • I created a sample Node.js WebJob script, zipped the script file, and uploaded it to Azure WebJobs.

    enter image description here

    ERR ] An error occurred trying to start process 'node.exe' with working directory '/home/site/wwwroot/App_Data/jobs/continuous/test3'. No such file or directory

    The above error occurred because of naming convention in web jobs.

    My script .sh:

    node run.js
    

    I can successfully see the Azure web job logs without any errors. enter image description here