Rank 3: Container
I have created it and it's my local machine IPv4 address right?
Votes
1
Replies
24
Participants
Unknown
Messages
25
Rank 3: Container
I have created it and it's my local machine IPv4 address right?
Rank 3: Container
Yeah right sir, I haven;t any of it
Rank 3: Container
I have created variables in my functions settings
Rank 3: Container
and given access to all
Rank 3: Container
and I have created api key which access functions and databases
Rank 3: Container
I have done everything that mentioned in the documentation. sir
Rank 3: Container
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, });};Admin
It would be best to remove them altogether so make sure it doesn't interfere with anything
Admin
Try increasing your function timeout to 4 minutes and try executing again
Rank 3: Container
please hold on sir, I am doing what you have suggested. 🙂 I think, it's been late night there.
Rank 3: Container
Do I need to give any events?
Rank 3: Container
Rank 3: Container
After I have increased the timeout, I don't know why, It is taking a lot of time to process.
Admin
Not if you're executing manually
Admin
There's your problem. The endpoint doesn't work
Rank 3: Container
What I need to do sir?
Rank 3: Container
It's my IP
Rank 3: Container
http://192.168.1.4/v1 I have given this
Admin
so how do you access your appwrite console?
Rank 3: Container
Rank 3: Container
It worked. Thank you
Admin
Operation Timed Out when Executing Function
Admin
[SOLVED] Operation Timed Out when Executing Function
Rank 3: Container
APPWRITE_FUNCTION_ENDPOIND = https://cloud.appwrite.io/v1
Rank 3: Container
If anyone faced this issue, this is the endpoint we have to set 🙂