```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
- Function's Static IP
Is it possible to have static. IP Address instead of Dynamic IP for getting the IP Address whitelist
- How to use dart workspaces to deploy a f...
Hello, I'm developing a Flutter application and I would like to leverage dart pub workspaces to deploy a function with a dart runtime as advertised here : http...
- [SOLVED] Unable to push function from AP...
When trying to push functions from Gitlab CI (with an API KEY and using the CLI), i saw that i was unable to push functions. ``` $ appwrite client --endpoint $...