Wednesday, January 9, 2019

Firebase : What is the main reason for this error?

I was deploying an AWS sails js app on Ubuntu EC2 instance and came across the below issue. Definitely the credential to the firebase was all correct, so the only issue left out was the time on the EC2 instance.

Amazingly it was 6 mins ahead of the GMT.

chronyc tracking
Reference ID    : 169.254.169.123 (169.254.169.123)
Stratum         : 4
Ref time (UTC)  : Wed Jan  9 18:07:53 2019
System time     : 386.305358887 seconds fast of NTP time
Last offset     : 0.000310425 seconds
RMS offset      : 0.000310425 seconds
Frequency       : 0.000 ppm fast
Residual freq   : 74.519 ppm
Skew            : 1000000.000 ppm
Root delay      : 0.000746 seconds
Root dispersion : 19.008415 seconds
Update interval : 0.0 seconds
Leap status     : Normal


Reading few posts, i could sense that the EC2 was not using NTP server time. Installed the NTP server sync on EC2 and after a reboot of the instance, the time was only off by a few nano millis!

[2019-01-09T18:18:20.225Z]  @firebase/database: FIREBASE WARNING: {"code":"app/invalid-credential","message":"Credential implementation provided to initializeApp() via the \"credential\" property failed to fetch a valid Google OAuth2 access token with the following error: \"Error fetching access token: invalid_grant (Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values and use a clock with skew to account for clock differences between systems.)\". There are two likely causes: (1) your server time is not properly synced or (2) your certificate key file has been revoked. To solve (1), re-sync the time on your server. To solve (2), make sure the key ID for your key file is still present at https://console.firebase.google.com/iam-admin/serviceaccounts/project. If not, generate a new key file at https://console.firebase.google.com/project/_/settings/serviceaccounts/adminsdk."}

No comments:

Post a Comment