Hi I'm trying out appwrite functions. So I created the following function with appwrite function init and deployed it with appwrite function deploy. However I cannot see the log seems to be empty?
const sdk = require("node-appwrite");
module.exports = async function (req, res) {
const client = new sdk.Client();
const account = new sdk.Account(client);
const database = new sdk.Databases(client);
const teams = new sdk.Teams(client);
const users = new sdk.Users(client);
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);
console.log(req); // I'd have hoped this logs?
}
res.json({
areDevelopersAwesome: true,
});
};
From what I know regular logs aren't being return. What I do is adding the stuff I want to log in the res.json
res.json({
req:req,
});
ok cool, I'll try that
<:appwriteupvote:899677724615016528>
[Solved] console.log in appwrite function
Recommended threads
- Appwrite SSL Certificate Failure
Hello, I need help releasing a stuck domain. My Domain: adilnaib.engineer My Project ID: 68fe0aee001e999b5d71 Error: Failed to add domain to Fastly: {"msg":"B...
- [BUG] I'm facing an issue while creating...
Here’s what’s happening: When I try to create a new Web app on my Appwrite console (backend.keplr.in), the browser console shows multiple errors: Uncaught (in...
- Sites: Old deployment gets requests even...
Hi team, I use Sites to host a Next.js web app and it serves from old deployment for many hours. Is this expected? I thought it would serve from new deployment ...