Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RemoteConfig condition names invalid via the Admin SDK but not console #2535

Closed
RKaySilverorange opened this issue Apr 19, 2024 · 7 comments
Closed

Comments

@RKaySilverorange
Copy link

RKaySilverorange commented Apr 19, 2024

Step 2: Describe your environment

  • Operating System version: Mac OS Sonoma 14.2.1
  • Firebase SDK version: 11.5.0
  • Firebase Product: Remote Config
  • Node.js version: ^18.13.0
  • yarn version: 1.22.19

Step 3: Describe the problem

I am creating a RemoteConfigTemplate which requires manipulating condition fields depending on a deployment target.

The the condition names I am using seem to be accepted within the console (I prototyped our RemoteConfig setup in the firebase console initially), but they fail validation when I call configAdmin.validateTemplate(template) via the Admin SDK:

message: '[VALIDATION_ERROR]: [POTato iOS Dev, POTato Android Dev, POTato Android Beta, POTato iOS Beta, POTato Android Prod, POTato iOS Prod] are not valid condition names. All keys in all conditional value maps must be valid condition names.'

POTato is just a stand in for a client's app name, but it follows the same pattern.

I wasn't able to find documentation on valid condition names, and I am thrown a bit by the fact that they seem to be valid when used via the firebase console.

Is there any spec available on what is a valid condition name? Also, if this isn't intended and filing a bug with the issue tracker would be useful, I am happy to do that.

Steps to reproduce:

Create a RemoteConfigTemplate in JSON locally. I initially did this by pulling down the RemoteConfig set up in the console as a JSON string. Set one of the conditions to have a name which matches the pattern specified above, and then attempt to validate it.

I read the template from a file using const template = configAdmin.createTemplateFromJSON(json); then validate it from there using await configAdmin.validateTemplate(template);.

Relevant Code:

Example JSON conditions

`"conditions": [
    {
      "name": "POTato iOS Dev",
      "expression": "app.id == 'EXAMPLE'",
      "tagColor": "PURPLE"
    },
    {
      "name": "POTato Android Dev",
      "expression": "app.id == 'EXAMPLE'",
      "tagColor": "PURPLE"
    }
  ]` 
@google-oss-bot
Copy link

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.

@jenh
Copy link
Contributor

jenh commented Apr 22, 2024

Parameter names don't allow spaces and the console usually blocks entry--can you remember how you added the parameter names to the Firebase console? Was it imported via the console or REST API?

Sounds like there may be a bug there (and our error message can be better and documentation clearer)!

@RKaySilverorange
Copy link
Author

Hello @jenh,

Thank you for responding.

Yes, these values were added via the console initially. I just tested this again with the variant name "Space Bar", and here is the result:

Screenshot 2024-04-23 at 6 10 49 AM

Screenshot 2024-04-23 at 6 11 18 AM

Let me know if I can provide any further info.

@RKaySilverorange
Copy link
Author

RKaySilverorange commented Apr 24, 2024

Hello,

I just attempted to publish a script via the Admin SDK and unfortunately I am now getting a different validation error. This time I used names which don't have spaces.

This response was given when I called config.publishTemplate(template); (config was a RemoteConfig object):

Error: [VALIDATION_ERROR]: [potato_ios_dev, potato_android_dev] are not valid condition names. All keys in all conditional value maps must be valid condition names.

I could use further clarification on what is a valid or invalid name.

@jenh
Copy link
Contributor

jenh commented Apr 28, 2024

Sorry--I got parameters and conditions confused there--condition names can definitely have spaces.

I'm able to publish a config with added and changed condition names with and without underscores using the sample code. Seems to work with a config pulled using the Admin SDK, but am running into (different) issues with the formatted JSON downloaded straight from the console UI.

Can you file a case for the Firebase Developer Support team with example code you're using to make the change and a sample config (and how it was obtained) for our Support team to take a closer look? Thank you!

@RKaySilverorange
Copy link
Author

RKaySilverorange commented Apr 29, 2024

@jenh I am just checking with my CTO about what I'm allowed to provide (it's a client's codebase); but if that's fine I will definitely file the issue.

Would it be possible for you to provide me with the template that you get from the Admin SDK (assuming it isn't sensitive)? I would like to compare it against what I have to see if something about the structure I am using is wrong.

Either way, thank you for the help.

Edit: I am particularly curious about what you have for the names in the conditionalValues objects; those are apparently what keep giving me trouble.

@RKaySilverorange
Copy link
Author

Closing the issue. I did end up finding an error in my JSON template which was leading to that validation issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants