Back

[SOLVED] Getting 500 error when trigger cloud function

  • 0
  • Functions
Yt
2 Oct, 2023, 07:01

Error message: An internal curl error has occurred within the executor! Error Msg: Operation timed out\nError Code: 500

Appwrite cloud Entry point: node index.js Execute Access: Any

I just deployed the example for node18.0 via github repository `const fetch = require("node-fetch");

module.exports = async (context) => { const payload = context.req.body;

TypeScript
const todo = await fetch(`https://jsonplaceholder.typicode.com/todos/${payload.id ?? 1}`).then(r => r.json());

return context.res.json({
    message: 'Hello Open Runtimes πŸ‘‹',
    todo
});

}`

According to the logs the build succeeded

And ran curl -H "X-Open-Runtimes-Secret: secret-key" -H "Content-Type: application/json" -X POST https://<function>.appwrite.global/ -d '{"payload": "{2}"}'

Locally it's working !!!

What I'm missing here (It's my first time I'm using function in appwrite)

TL;DR
Title: [SOLVED] 500 Error when Triggering Cloud Function in Appwrite Solution: The issue was caused by using the incorrect command to run the cloud function. Instead of using "node index.js", only "index.js" should be specified as the entry point in the Appwrite configuration. Details: The user was experiencing a 500 Error when triggering a cloud function in Appwrite. The error message stated that an internal curl error occurred and the operation timed out. The user had deployed a node18.0 example via a GitHub repository. The code for the function involved fetching data from a URL and returning JSON. The
Yt
2 Oct, 2023, 07:03

Getting 500 error when trigger cloud function

Yt
2 Oct, 2023, 07:45

Found the issue, it should be only index.js and not node index.js

Drake
4 Oct, 2023, 17:02

[SOLVED] Getting 500 error when trigger cloud function

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