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
- Invalid `region` param: Value must be on...
Hi! I'm trying to migrate a small project from the cloud to a self hosted instance to play around but without any success! I cannot initiate a migration witho...
- Migration from cloud to self-hosted fail...
Hi! I'm trying to migrate a small project from the cloud to a self hosted instance to play around but without any success! The migration process fails with the ...
- Feedback and Deployment Challenges with ...
Hello world!, I've been developing a project using FastAPI in Python, and I was considering deploying it through Appwrite Functions. However, I encountered a f...