I’ve been trying to get this working for the whole day, since I was told Netlify supports SvelteKit server functions from accessing static files (while vercel does not)
For context, I have a serverless function that takes writes to the /tmp
file directory, then executes a child process function against that file.
I have a single executable script written in C# dotnet, which I have in my static
directory, that when called through the command line, it converts a specific file type to another file type
It can be executed in the terminal, i.e. /<script-file-name> <file-to-convert>
I have a sveltekit app that runs node’s exec
child process command, and it works great in local development.
I’m trying to find a way to deploy this (vercel states their serverless runtime is in x64, assuming the same for netlify) , however, I keep running into the error of ‘no such file or directory found’ when calling the execute function
Nov 5, 10:33:03 PM: 67568ff3 ERROR Error: error executing function: Error: Command failed: /scripts/guitarprotomidi /tmp/<my-file>
/bin/sh: /scripts/guitarprotomidi: No such file or directory
at ExecuteService.executeConvert (file:///var/task/.netlify/server/entries/pages/_page.server.ts.js:31:13)
at async ExecuteService.writeFileAndConvert (file:///var/task/.netlify/server/entries/pages/_page.server.ts.js:11:5)
at async default (file:///var/task/.netlify/server/entries/pages/_page.server.ts.js:79:49)
at async handle_action_json_request (file:///var/task/.netlify/server/index.js:382:18)
at async resolve (file:///var/task/.netlify/server/index.js:2670:24)
at async respond (file:///var/task/.netlify/server/index.js:2556:22)
at async Runtime.handler (file:///var/task/.netlify/serverless.js:301:20)
I confirmed that the scripts
directory is getting uploaded to the deployment, and I’ve tried calling it from every possible way
i.e. doing
path.join(process.cwd(), 'scripts', 'guitarprotomidi');
./scripts/guitarprotomidi
, ../scripts/guitarprotomidi
, etc.
Let me know if this is possible