```js import {Client, ID, Messaging} from 'node-appwrite';
export default async ({req, res, log, error}) => { if (req.method !== 'GET') return res.json({message: 'Method not allowed'}, 405);
const client = new Client()
.setEndpoint(process.env.APPWRITE_FUNCTION_API_ENDPOINT)
.setProject(process.env.APPWRITE_FUNCTION_PROJECT_ID)
.setKey(req.headers['x-appwrite-key']);
const messaging = new Messaging(client);
await messaging.createEmail({
topics: ['69781a8c0003xxxxxx'],
subject: 'Test',
content: '<h1>Test</h1>',
html: true,
messageId: ID.unique(),
});
return res.empty();
};
The execution gets an error: ```Execution timed out.``` but the email is sent correctly??
Im very much confused as to why the return res.empty() would fail??
Even after adjusting timeout from 15s to 30s it sends the message within the first 10s and the just stays at processing status until it times out
I even tried to use a different response (res.json(...)) and still not responding
I dont know if I've solved this myself but I have swapped the runtime from the default node-16.0 to node-22 and that seems to have fixed it
Still seems weird to me why this would be the issue 🤷♂️
Can you try changing the red empty to something else?
I already tried that
.
How did you create the function? Did you start from a template?
starter template, and i built and deployed it using a gitlab pipeline
and appwrite cli
So did you deploy the starter template and it worked?
starter template worked
Recommended threads
- Production down - createExecution return...
Hey, Since 1.9.6 rollout in fra (~17:00 UTC, 14 Aug), POST /v1/functions/{functionId}/executions returns a 400 whenever the body includes an empty headers ob...
- CreateRow is doing ListRows on self-host...
### setup ``` appwrite 1.9.5 self-hosted bun 1.3 node-appwrite 27.1.0 ``` ### issue Im running a function on a self hosted 1.9.5 with "node-appwrite": "^27.1.0...
- Local function execution results in HTTP...
Hi all, I'm trying to develop a new function on my Ubuntu 24.04 machine running the latest version of docker. I've read through the documentation to install and...