Server time went out of sync

Last Sunday night I received a call from one of my clients that the pdf generation stopped working! What on earth! It was working fine for the 2 years and it decided this Sunday to stop working? What happened? I checked the code (nothing was committed accidentally). Checked the requests “Server can not generate pdf”. Then after a bit of debugging it turned out that the code that was uploading the generated PDF to Amazon S3 was throwing an error. Luckily the error description was quite clear:

The difference between the request time and the current time is too large.

So right away I checked the hour of the server that generates the PDF files & indeed it was around 15 mins in front. After a bit of looking up online I found that you can sync your server time using the command below. And that right away solved the issue & PDF generation was magically fixed 🙂


sudo ntpdate ntp.ubuntu.com
sudo apt install ntp
sudo systemctl reload ntp.service

You can read more about it on Ubuntu documentation

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s