Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: error message and server time getting

peaklabs-dev503d2b486605
diff --git a/bootstrap/helpers/github.php b/bootstrap/helpers/github.php
index 3ed588bdb1..e646aa7381 100644
--- a/bootstrap/helpers/github.php
+++ b/bootstrap/helpers/github.php
@@ -15,16 +15,16 @@ use Lcobucci\JWT\Token\Builder;
function generateGithubToken(GithubApp $source, string $type)
{
$response = Http::get("{$source->api_url}/zen");
- $serverTime = now();
+ $serverTime = CarbonImmutable::now()->setTimezone('UTC');
$githubTime = Carbon::parse($response->header('date'));
$timeDiff = abs($serverTime->diffInSeconds($githubTime));
if ($timeDiff > 0) {
throw new \Exception(
- "System time is out of sync with GitHub API time:\n".
- "- System time: {$serverTime->format('Y-m-d H:i:s')} UTC\n".
- "- GitHub time: {$githubTime->format('Y-m-d H:i:s')} UTC\n".
- "- Difference: {$timeDiff} seconds\n".
+ 'System time is out of sync with GitHub API time:'.PHP_EOL.
+ '- System time: '.$serverTime->format('Y-m-d H:i:s').' UTC'.PHP_EOL.
+ '- GitHub time: '.$githubTime->format('Y-m-d H:i:s').' UTC'.PHP_EOL.
+ '- Difference: '.$timeDiff.' seconds'.PHP_EOL.
'Please synchronize your system clock.'
);
}