firebase-admin-node: firebase remote config get template api fails throws "Version update time must be a valid date string"

Issue is reproducible in Firebase cloud function and in the local cloud function simulator(started occurring from 13-nov-2020)

  • Firebase SDK version: 9.4.0
  • Firebase Product: remote config
  • Node.js version: 10.10.0

Firebase node admin api “admin.remoteConfig().getTemplate() or config.getTemplateAtVersion” throws error

{"code":"remote-config/invalid-argument","message":"Version update time must be a valid date string"}

The issue is reproducible for all remote config versions updated today(using firebase ui or rest api). Older remote config versions can be fetched.

config.getTemplateAtVersion(today's version) -> fails
config.getTemplateAtVersion(yesterday or previous version) -> works

Steps to reproduce:

update a remote config api using firebase ui. get the template using the admin api

additional information

The version details of today’s config(which doesn’t work) look like

{
  "versionNumber": "7771",
  "updateTime": "2020-11-13T08:02:12.468168Z",
.....
}

Version details of old remote config (which work)

{
  "versionNumber": "7740",
  "updateTime": "2020-11-12T14:53:52.351Z",
...

You can see the time format is different for new and old remote config. I guess that’s the reason why api is failing

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 6
  • Comments: 27 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Thank you for reporting this issue! We are currently working on a fix and this issue will track the progress. Thank you for your patience!

Thank you everyone for your patience! We have included the fix in 9.4.1. We will continue to investigate the cause with the backend teams and will take measures to prevent any similar breaking changes in the future.

Updated - error went away immediately. Much appreciated. 😃

I see that the fix was merged, are you going to publish a new release of the firebase-admin npm? The latest is still 9.4.0, and this issue was closed.

Yes, it’s on the way. We are also following up with the backend team to figure out why the date format changed suddenly (and will continue to do so after the release too).

I noticed that the problem seems to be related to the number of places used for the milliseconds This is the version time that is being returned for me 2020-11-13T18:30:14.543720Z, for a valid ISO it should be just 3 instead of 6 before the Z, so 2020-11-13T18:30:14.543Z

The code falling is this one:

if (typeof version.updateTime !== 'undefined') {
            if (!validator.isISODateString(version.updateTime) &&
                !validator.isUTCDateString(version.updateTime)) {
                throw new remote_config_api_client_internal_1.FirebaseRemoteConfigError('invalid-argument', 'Version update time must be a valid date string');
            }
            if (validator.isISODateString(version.updateTime)) {
                // timestamps in output `Version` obtained from the API should be in UTC.
                this.updateTime = new Date(version.updateTime).toUTCString();
            }
        }

The isISODateString fails with 6 but works with 3 milliseconds places. No idea how that happened, any suggestions on how to fix this is appreciated.