
I have created it and it's my local machine IPv4 address right?

Yeah right sir, I haven;t any of it

I have created variables in my functions settings

and given access to all

and I have created api key which access functions and databases

I have done everything that mentioned in the documentation. sir

const sdk = require("node-appwrite");
const dotenv = require('dotenv');
dotenv.config();
const { v4:uuidv4} = require('uuid');
const express = require('express');
const app = express();
app.use(express.json());
module.exports = async function (req, res) {
const client = new sdk.Client();
const database = new sdk.Databases(client);
const cartItem = await JSON.parse(req.payload);
const { customer_id, location_id, product_id, seller_id, quantity } = cartItem;
if (
!req.variables['APPWRITE_FUNCTION_ENDPOINT'] ||
!req.variables['APPWRITE_FUNCTION_API_KEY']
) {
console.warn("Environment variables are not set. Function cannot use Appwrite SDK.");
} else {
client
.setEndpoint(req.variables['APPWRITE_FUNCTION_ENDPOINT'])
.setProject(req.variables['APPWRITE_FUNCTION_PROJECT_ID'])
.setKey(req.variables['APPWRITE_FUNCTION_API_KEY'])
.setSelfSigned(true);
let newCartItem = {}
if (customer_id && location_id && product_id && seller_id && quantity) {
try {
newCartItem = await database.createDocument(req.variables['ECOMM_DB_ID'], req.variables['CART_COLLECTION_ID'], uuidv4(), cartItem);
return res.json({
success: true,
error: false,
message: 'New Item is successfully added to cart :)',
data: newCartItem
})
} catch (error) {
return res.json({
success:false,
error: true,
message: error.message
})
}
} else {
res.json({
success:false,
error: true,
message: "All Fields are required :("
})
}
}
res.json({
areDevelopersAwesome: true,
});
};

It would be best to remove them altogether so make sure it doesn't interfere with anything

Try increasing your function timeout to 4 minutes and try executing again

please hold on sir, I am doing what you have suggested. 🙂 I think, it's been late night there.

Do I need to give any events?


After I have increased the timeout, I don't know why, It is taking a lot of time to process.

Not if you're executing manually

There's your problem. The endpoint doesn't work

What I need to do sir?

It's my IP

http://192.168.1.4/v1
I have given this

so how do you access your appwrite console?


It worked. Thank you

Operation Timed Out when Executing Function

[SOLVED] Operation Timed Out when Executing Function

APPWRITE_FUNCTION_ENDPOIND = https://cloud.appwrite.io/v1

If anyone faced this issue, this is the endpoint we have to set 🙂
Recommended threads
- my database attribute stuck in processin...
when i created attributes in collection 3 of those attributes become "processing", and they are not updating, the worst thing is that i cant even delete them s...
- Is Quick Start for function creation wor...
I am trying to create a Node.js function using the Quick Start feature. It fails and tells me that it could not locate the package.json file. Isn't Quick Start ...
- Forever Processing Issue
I encountered an issue when creating attributes in the collections . if you create an attribute of type string for example and choose a size of 200 or 250 or a...
