1
0
Fork 0
mirror of synced 2024-10-03 19:53:33 +13:00

QA bug fixing

This commit is contained in:
Matej Bačo 2023-03-05 09:12:01 +01:00
parent d0df9408af
commit 056ea0820e
2 changed files with 13 additions and 4 deletions

View file

@ -145,6 +145,11 @@ Server::setResource('execute', function () {
'APPWRITE_FUNCTION_JWT' => $jwt ?? '', 'APPWRITE_FUNCTION_JWT' => $jwt ?? '',
]); ]);
$body = $vars['APPWRITE_FUNCTION_EVENT_DATA'] ?? '';
if(empty($body)) {
$body = $vars['APPWRITE_FUNCTION_DATA'] ?? '';
}
/** Execute function */ /** Execute function */
try { try {
$client = new Executor(App::getEnv('_APP_EXECUTOR_HOST')); $client = new Executor(App::getEnv('_APP_EXECUTOR_HOST'));
@ -152,7 +157,7 @@ Server::setResource('execute', function () {
projectId: $project->getId(), projectId: $project->getId(),
deploymentId: $deploymentId, deploymentId: $deploymentId,
version: $function->getAttribute('version'), version: $function->getAttribute('version'),
body: $vars['APPWRITE_FUNCTION_DATA'] ?? '', body: $body,
variables: $vars, variables: $vars,
timeout: $function->getAttribute('timeout', 0), timeout: $function->getAttribute('timeout', 0),
image: $runtime['image'], image: $runtime['image'],
@ -311,9 +316,11 @@ $server->job()
data: null, data: null,
executionId: null, executionId: null,
jwt: null, jwt: null,
path: $payload['path'], path: '/',
method: $payload['method'], method: 'POST',
headers: $payload['headers'], headers: [
'user-agent' => 'Appwrite/' . APP_VERSION_STABLE
],
); );
Console::success('Triggered function: ' . $events[0]); Console::success('Triggered function: ' . $events[0]);
} }

View file

@ -130,6 +130,8 @@ class Executor
string $method, string $method,
array $headers, array $headers,
) { ) {
$headers['host'] = App::getEnv('_APP_DOMAIN', '');
$runtimeId = "$projectId-$deploymentId"; $runtimeId = "$projectId-$deploymentId";
$route = '/runtimes/' . $runtimeId . '/execution'; $route = '/runtimes/' . $runtimeId . '/execution';
$params = [ $params = [