
Yes, there was a restart between the errors.

maybe try redeploying?

The function has been updated and adjusted for 1.3.0. But the result is the same :/

Have you tried deleting the variables and adding them back?

Just tried that, but has no impact.

Can I be sure, that the error is located within the read of the environment variable or can it also be an issue on the MongoDB side?

I just looked for a function, where I didn't use the MONGODB_USER
. I get the same error for an other environment variable with the same error message. So in conclusion it shouldn't be related to the MongoDB connection.

The stack trace seems to indicate it's req.variables problem.

What's docker ps
show?

What exactly should be expected? The Function Container are listed.

all the appwrite containers and their versions...


would you please make sure to show the container names?

Hope it is readible

can you check the docker logs for the appwrite-executor and appwrite-worker-functions containers to see if there are any errors/warnings?

appwrite-executor:

could you also try updating your code to do this at the beginning:
res.json(req);
return;

docker logs 630f8d82d13133b826cc-6452b553edb419672a03

import { Client, Account } from 'node-appwrite';
module.exports = async function (req: any, res: any) {
const client = new 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'])
.setJWT(req.variables['APPWRITE_FUNCTION_JWT'])
.setSelfSigned();
}
const account = new Account(client);
let promise = account.get();
promise.then(
function (response) {
let userId = response.$id;
},
function (error) {
console.log(error); // Failure
}
);
async function run() {
try {
//Create Response
res.json(req);
return;
} catch (error) {
console.log('Error parsing JSON:', error, req.payload);
} finally {
}
}
run().catch(console.dir);
};
Is this sufficient (after compiling to JS)?

ideally, you would compile and deploy:
module.exports = async function (req: any, res: any) {
res.json(req);
}
in the same function as your previous one

I think i found the problem...

let me see how fast we can fix this

I tried today your minimal function. It worked fine. After that all the functions worked fine as well. There was another restart between the tests, so I am not sure what cured the error. I am unable to reproduce my error, but for now it works fine again. It would be nice, if the error could be scrutinized, because otherwise my app would have unexpected downtime, once I go to production.

Ya...sorry, we had a problem with our runtime image

No reason to be sorry about.😉 I very much appreciate the dedication you guys put into the project and also your quick help and support. Thanks a lot for that! <:appwriteheart2:1073243188954935387> 🙂
Recommended threads
- 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 ...
- Connecting server functions to GitHub re...
The project I am working in has recently moved organizations on Appwrite. The same is true for the repo on GitHub, which as moved from a private user to a organ...
- Missing C++ libstdc library in Python fu...
I have a function running Python 3.12 which suddenly started dumping errors (as of today; it worked yesterday). I hadn't changed any code so I found this odd, b...
