Rank 2: Process
Yes, there was a restart between the errors.
Votes
0
Replies
24
Participants
Unknown
Messages
25
Rank 2: Process
Yes, there was a restart between the errors.
Admin
maybe try redeploying?
Rank 2: Process
The function has been updated and adjusted for 1.3.0. But the result is the same :/
Admin
Have you tried deleting the variables and adding them back?
Rank 2: Process
Just tried that, but has no impact.
Rank 2: Process
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?
Rank 2: Process
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.
Admin
The stack trace seems to indicate it's req.variables problem.
Admin
What's docker ps show?
Rank 2: Process
What exactly should be expected? The Function Container are listed.
Admin
all the appwrite containers and their versions...
Rank 2: Process
Admin
would you please make sure to show the container names?
Rank 2: Process
Hope it is readible
Admin
can you check the docker logs for the appwrite-executor and appwrite-worker-functions containers to see if there are any errors/warnings?
Rank 2: Process
appwrite-executor:
Admin
could you also try updating your code to do this at the beginning:
res.json(req);return;Rank 2: Process
docker logs 630f8d82d13133b826cc-6452b553edb419672a03
Rank 2: Process
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)?
Admin
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
Admin
I think i found the problem...
Admin
let me see how fast we can fix this
Rank 2: Process
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.
Admin
Ya...sorry, we had a problem with our runtime image
Rank 2: Process
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!
🙂