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.
#!/bin/bash
node run.js
stack correctly on nodejs 20 enabled SCM Basic Auth
worth noting, the script runs fine if directly instancied from ssh within the appservice (xxxxx.scm.azurewebsites.net/newui/webssh)
Tried deployment via
run.js
(simplied a bit ;))
console.log("I'm alive");
script.sh
#!/bin/bash
/opt/node-wrapper/node run.js
I created a sample Node.js WebJob script, zipped the script file, and uploaded it to Azure WebJobs.
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.
run.js
, the WebJob considers it as an entry point, and it can cause errors.run.js
to any other name like index.js
or server.js
.run.js
, then you should also change the .sh
file name to run.sh
to ensure it works correctly.My script .sh:
node run.js
I can successfully see the Azure web job logs without any errors.