Firebase-tools: Setting functions config with array items

Created on 20 Mar 2017  ยท  5Comments  ยท  Source: firebase/firebase-tools

Setting an array in the config produces a http error:

firebase functions:config:set intercom.admin_ids.0="989270" intercom.admin_ids.1="737963"
i  runtimeconfig: ensuring necessary APIs are enabled...
โœ”  runtimeconfig: all necessary APIs are enabled

Error: HTTP Error: 400, Precondition check failed.

Having trouble? Try firebase functions:config:set --help

I believe this was working beforehand but I don't have proof. Setting the array
intercom.admin_ids=["989270", "737963"] worked.

Most helpful comment

Okay, another update:
I got it to work again, but had to go up a level:

firebase functions:config:set intercom_admin_ids.0="989270" intercom_admin_ids.1="737963"

(e.g. rather than going intercom>admin_ids)

One of my projects still has the old config with the array 3 levels down. It definitely looks like something changed since yesterday (Would appreciate acknowledgment of a remote change to reconfirm my sanity ๐Ÿ˜‚). I'm just going to move things up a level, so workaround = found โœ”

All 5 comments

Actually, I take that back, it didn't work out for me.

firebase functions:config:set intercom.admin_ids={0:"989270",1:"737963"}
results in:
"admin_ids": "1:737963"

firebase functions:config:set intercom.admin_ids={"989270","737963"}
results in:
"admin_ids": "737963"

firebase functions:config:set intercom.admin_ids=["989270","737963"]
results in:
"admin_ids": "[989270,737963]"
_(Which looked correct at first but is actually a string)_

firebase functions:config:set intercom.admin_ids[0]="989270"
results in an error:

i  runtimeconfig: ensuring necessary APIs are enabled...
โœ”  runtimeconfig: all necessary APIs are enabled

Error: HTTP Error: 400, Request contains an invalid argument.

I'm almost certain I used firebase functions:config:set intercom.admin_ids={0:"989270",1:"737963"} yesterday to get the result:

"admin_ids": [
      "989270",
      "737963"
    ]

Could something have changed remotely with that HTTP Error precheck?

Just to confirm, I grep'd through my history from yesterday and can confirm firebase functions:config:set intercom.admin_ids.0="989270" intercom.admin_ids.1="737963" gave me:

"admin_ids": [
      "989270",
      "737963"
    ]

I'll also log this with firebase support as it seems to be a remote issue. Any workarounds on getting arrays working in the meantime would be appreciated.

We haven't fully considered support for array config. I'd recommend using a
string e.g. comma-separated values and splitting them in the function code
itself.

On Mon, Mar 20, 2017 at 1:25 PM Alan Haverty notifications@github.com
wrote:

Just to confirm, I grep'd through my history from yesterday and can
confirm firebase functions:config:set intercom.admin_ids.0="989270"
intercom.admin_ids.1="737963" gave me:

"admin_ids": [
"989270",
"737963"
]

I'll also log this with firebase support as it seems to be a remote issue.
Any workarounds on getting arrays working in the meantime would be
appreciated.

โ€”
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/firebase/firebase-tools/issues/284#issuecomment-287886417,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAD_kn6Ff2x3P9bzwS69rYlPR34z_6xks5rnuCfgaJpZM4Mi43B
.

Okay, another update:
I got it to work again, but had to go up a level:

firebase functions:config:set intercom_admin_ids.0="989270" intercom_admin_ids.1="737963"

(e.g. rather than going intercom>admin_ids)

One of my projects still has the old config with the array 3 levels down. It definitely looks like something changed since yesterday (Would appreciate acknowledgment of a remote change to reconfirm my sanity ๐Ÿ˜‚). I'm just going to move things up a level, so workaround = found โœ”

Thanks @mbleigh Is there anywhere I can track what's supported/recommended and not recommended for future? ๐Ÿ‘

Was this page helpful?
0 / 5 - 0 ratings