
Hello, I'm currently rewriting my Cloudfunctions to the new syntax. I have one problem with error handling in a promise.
Old:
module.exports = async function (req, res) {
// some code
promise.then(
function (response) {
console.log(response);
},
function (error) {
console.log(error);
},
);
//some code
};
New:
export default async ({ req, res, log, error }) => {
// some code
promise.then(
function (response) {
log(response);
},
function (error) {
error(error);
},
);
//some code
};
In the New version I get the Error " error is declared but its value is never read." for the deconstructured context function. I think this is more like a general JavaScript problem, but can you help me out?

Are you using TS?

No

Please verify that if we have the same configuration
{
"name": "starter-template",
"version": "1.0.0",
"description": "",
"main": "src/main.js",
"type": "module",
"scripts": {
"format": "prettier --write ."
},
"dependencies": {
"node-appwrite": "^9.0.0"
},
"devDependencies": {
"prettier": "^3.0.0"
}
}

.prettierrc.json
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true
}

Yes, I can confirm that it is the same configuration.

you're redeclaring the error
variable which can cause problems.
Recommended threads
- Sharing cookies
Hi, I’m using Appwrite Cloud, and I have a setup where my Appwrite backend is hosted on a subdomain (e.g., api.example.com), while my frontend (Next.js app) and...
- Organization not exists anymore
Hello! We have a problem with a cloud database. We are on the Free plan, but after a refresh the site wants me to create a new organisation, and I not see the c...
- JSON and Object Support in Collection do...
I am working with Next.Js and Appwrite Cloud, I am relatively New to Appwrite but i have noticed there is no direct support of JSON and Object support in attrib...
