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
I found a few problems with this issue:
- I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
- This issue does not seem to follow the issue template. Make sure you provide all the required information.
I am also facing the same issue
Experiencing same issue cant get remote config values in my cloud functions.
We also facing this one since today.
Same here
I'm also facing the same problem, I've debugging like crazy the past few hours until I found this issue.
For me, the parameter was added no longer than the past few hours. And the command
admin.remoteConfig().getTemplate()
Will fail with the same error described in the issue.
I've also tried downgrading firebase-admin to version 9.2.0, and 9.0.0 but doesn't really help.
Seeing this issue today as well
Same here, issue appeared overnight with no code changes or even npm update
Same issue here. Appeared overnight with no code changes. Tried all I can think of but still fails when hitting this line "admin.remoteConfig().getTemplate();" Only thing I did for it to start failing is add a new Remote Config setting as described.
Happening to us as well. just started today
Same issue here.
Stack trace:
PrefixedFirebaseError: Version update time must be a valid date string at FirebaseRemoteConfigError.FirebaseError [as constructor] (/Users/matheusr/Documents/B2B/platform-config/mobile/firebase-autosync/node_modules/firebase-admin/lib/utils/error.js:43:28) at FirebaseRemoteConfigError.PrefixedFirebaseError [as constructor] (/Users/matheusr/Documents/B2B/platform-config/mobile/firebase-autosync/node_modules/firebase-admin/lib/utils/error.js:89:28) at new FirebaseRemoteConfigError (/Users/matheusr/Documents/B2B/platform-config/mobile/firebase-autosync/node_modules/firebase-admin/lib/remote-config/remote-config-api-client-internal.js:403:23) at new VersionImpl (/Users/matheusr/Documents/B2B/platform-config/mobile/firebase-autosync/node_modules/firebase-admin/lib/remote-config/remote-config.js:297:23) at new RemoteConfigTemplateImpl (/Users/matheusr/Documents/B2B/platform-config/mobile/firebase-autosync/node_modules/firebase-admin/lib/remote-config/remote-config.js:208:28) at /Users/matheusr/Documents/B2B/platform-config/mobile/firebase-autosync/node_modules/firebase-admin/lib/remote-config/remote-config.js:61:20 at processTicksAndRejections (internal/process/task_queues.js:97:5) at async getConfig (/Users/matheusr/Documents/B2B/platform-config/mobile/firebase-autosync/index.js:21:12) at async main (/Users/matheusr/Documents/B2B/platform-config/mobile/firebase-autosync/index.js:48:28) { errorInfo: { code: 'remote-config/invalid-argument', message: 'Version update time must be a valid date string' }, codePrefix: 'remote-config' }
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.
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!
The issue is happening because of isISODateString check This should be a high priority ticket as it is breaking all code the depends on firebase remoteConfig
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 theZ, so2020-11-13T18:30:14.543ZThe 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
isISODateStringfails with 6 but works with 3 milliseconds places. No idea how that happened, any suggestions on how to fix this is appreciated.
Yes, that is exactly the case.
I very much appreciate how quickly this was fixed! You developers are amazing ❤️
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.
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).
Thank you so much. You all rock! 👍
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.
I am still facing this issue.
errorInfo: { code: 'remote-config/invalid-argument', message: 'Version update time must be a valid date string' }, codePrefix: 'remote-config' }