diff --git a/bref b/bref
index 5703985a3..8723c606f 100755
--- a/bref
+++ b/bref
@@ -109,14 +109,15 @@ $app->command('cli function [--region=] [arguments]*', function (string $functio
return 1;
}
- if (isset($result->getPayload()['output'])) {
- $io->writeln($result->getPayload()['output']);
+ $payload = $result->getPayload();
+ if (isset($payload['output'])) {
+ $io->writeln($payload['output']);
} else {
$io->error('The command did not return a valid response.');
$io->writeln('Logs:');
$io->write('' . $result->getLogs() . '');
$io->writeln('Lambda result payload:');
- $io->writeln(json_encode($result->getPayload(), JSON_PRETTY_PRINT));
+ $io->writeln(json_encode($payload, JSON_PRETTY_PRINT));
return 1;
}