An internal curl error has occurred within the executor! Error Msg: Operation timed out
- 0
- Self Hosted
I assigned the API_KEY variable in a file and uploaded it to the function. I did this just once. Every time I make a change to index.php, I create a deployment on the command line of my Mac, and it shows up as a new active deployment. I then execute the function by clicking the Execute Now button. If the prior execution failed, this one will succeed. Then the next one will fail, ad infinitum. So it appears that appwrite has a memory across function executions, and it passes the API_KEY variable on every other execution only.
You mean you're uploading a .env file?
What command are you running to deploy the function?
I "imported" an .env file. I did that at the initial creation of the function. The command I used to deploy the function is appwrite functions createDeployment --functionId=650d12f2bf31e2ea6fba --entrypoint='index.php' --code="." --activate=true
API_KEY isn't false, right? It's not set at all?
I have it set to the password I use for my appwrite account. It's also the value of the openssl key. All three are the same value.
I mean when it fails, it's not set to false, right?
If you log $req['variables']
, it's either an empty array or an array with variables?
All the variables are there. That's not the cause. If I put in this function ```function returnAllTheTanks($api_key) { //$q = new Query();
//$tankQuery = [ $q->equal("facility_fk",'64bdd24440f7ab4908db'),$q->limit(5000)]; // 64bdd24440f7ab4908db is facility document id (not facility collection)
//return queryDocument('6408223c577dec6908e7', $tankQuery, $api_key); // 6408223c577dec6908e7 is tank collection id
}``` where I have an empty function body because thatβs commented out, I get the cyclical failing. If I totally comment out this function, it always runs, so it appears there's something going on with php interpreter inside appwrite that is triggering these failures.
how long do the successes and failures take? I wonder if it actually could be timing out
@Steven could this mean one of ur many workers and DBs are flakey?
Oh this is different than what you mentioned before...So what's the full code that's failing now?
Maybe...but probably not π§
Whether a given execution fails or succeeds is 100% dependent on what the last execution did. Last execution failed; the upcoming will succeed Last executions succeeds; the upcoming will fail
The following code triggers this type of behavior
<?php
require 'vendor/autoload.php';
use Appwrite\Client;
use Appwrite\Services\Databases;
use Appwrite\Query;
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
return function ($req, $res) {
function returnAllTheTanks($api_key) {
}
$res->json([
'message' => 'Did I pass!',
]);
}
?>
The mere presence of the empty function
function returnAllTheTanks($api_key) {
}
is a deciding factor. Take it out and the function will always succeed.
Thanks for this. I'll try to reproduce the problem with this
That's bizarre! so curious why this changes anything
apologies for the delay. did you figure out the problem? Have you tried using the new 1.4 syntax?
in 1.4, i initialized a starter function using the CLI and modified it as such:
<?php
require(__DIR__ . '/../vendor/autoload.php');
use Appwrite\Client;
// This is your Appwrite function
// It's executed each time we get a request
return function ($context) {
function returnAllTheTanks($context) {
$context->log('inside returnAllTheTanks!');
}
returnAllTheTanks($context);
// You can log messages to the console
$context->log('Hello, Logs!');
// If something goes wrong, log an error
$context->error('Hello, Errors!');
// The `req` object contains the request data
if ($context->req->method === 'GET') {
// Send a response with the res object helpers
// `res.send()` dispatches a string back to the client
return $context->res->send('Hello, World!');
}
// `res.json()` is a handy helper for sending JSON
return $context->res->json([
'motto' => 'Build like a team of hundreds_',
'learn' => 'https://appwrite.io/docs',
'connect' => 'https://appwrite.io/discord',
'getInspired' => 'https://builtwith.appwrite.io',
]);
};
and it worked fine
Sorry, I am still using 1.3.7. I just run the script twice. Once the users are comfortable with my app, which I just rolled out, I'll plan to upgrade to 1.4.x.
Are you still having problems with the function?
It's actually been working under the cron schedule on 1.3.7.
How'd you solve the problem?
I didn't. It appears under cron, it works. I haven't tested it manually since.
Actually, I just found this post about how you can't declare a function twice π§
https://stackoverflow.com/questions/1631535/function-inside-a-function
Maybe that's the problem
Maybe it works via schedule because the runtime container is actually shut down between executions
Recommended threads
- Realtime with multiple connections
I need the Realtime on multiple Collections for diffrent applicational logic. So my question is: Is there a way to have only 1 Websocket connection or do I need...
- Can't login or deploy functions in Appwr...
Hello, since i updatet to the appwrite cli 6.1.0 i can't login or deploy functions with the cli. When i call the command: "appwrite get account --verbose" i ge...
- Create admin user?
I'm not really sure how this is supposed to work, I installed Appwrite through docker-compose and set it up. When I launched the app and went into it, I created...