Back

Failing to run curl command from NodeJS Function on version 1.5.x

  • 0
  • Self Hosted
  • Functions
6lackknight
7 Apr, 2024, 17:01

I am recieiving this error when I run a function which calls the exec function then runs the curl command.

Can I run commands using exec in NodeJS in an Appwrite function?

The error: Error: Command failed: curl -X POST https://xxxxxx.erply.com/api/ -d "clientCode=xxxxxx&username=xxx@xxxx.xx&password=xxxxxxxxx&request=verifyUser&sendContentType=1" /bin/sh: curl: not found

TypeScript
at ChildProcess.exithandler (node:child_process:398:12)
at ChildProcess.emit (node:events:527:28)
at maybeClose (node:internal/child_process:1092:16)
at Socket.<anonymous> (node:internal/child_process:451:11)
at Socket.emit (node:events:527:28)
at Pipe.<anonymous> (node:net:709:12)
TL;DR
Developers are trying to run a curl command from a NodeJS function on version 1.5.x but encounter an error "curl: not found". Instead of using exec in NodeJS, suggest making the API call directly.
Steven
7 Apr, 2024, 17:08

As it says, curl is not installed

But why are you exec'ing when you can make the API call in node?

6lackknight
7 Apr, 2024, 17:18

curl not installed on the base machine?

Steven
7 Apr, 2024, 17:19

In the container

6lackknight
7 Apr, 2024, 17:23

which specific one? I just tried installing curl on 'appwrite' and got same result. I used docker exec -it appwrite /bin/sh then used apk add curl

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more