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

Add missing JSON.stringify in database:settings:set #3217

Merged
merged 4 commits into from
Mar 24, 2021

Conversation

jmwski
Copy link
Contributor

@jmwski jmwski commented Mar 17, 2021

Description

Fixes #3228

The namespace server expects string-value .settings/<setting>.json values to be quoted. For defaultWriteSizeLimit, this meant that passing unlimited broke with this error log in firebase-debug.log:

[debug] [2021-03-17T22:10:45.519Z] <<< [apiv2][body] PUT https://fir-multi-shards.firebaseio.com/.settings/defaultWriteSizeLimit.json {"error":"defaultWriteSizeLimit should be one of {\"small\", \"unlimited\", \"large\", \"medium\"}"}
[debug] [2021-03-17T22:10:45.636Z] FirebaseError: HTTP Error: 400, defaultWriteSizeLimit should be one of {"small", "unlimited", "large", "medium"}
    at module.exports (/usr/local/google/home/wyszynski/.nvm/versions/node/v10.15.3/lib/node_modules/firebase-tools/lib/responseToError.js:38:12)
    at Client.doRequest (/usr/local/google/home/wyszynski/.nvm/versions/node/v10.15.3/lib/node_modules/firebase-tools/lib/apiv2.js:238:23)
    at process._tickCallback (internal/process/next_tick.js:68:7)
[error]

Sample Commands

I tried setting the two supported database settings:

node ./lib/bin/firebase.js --project fir-multi-shards database:settings:set strictTriggerValidation false --instance fir-multi-shards

And:

node ./lib/bin/firebase.js --project fir-multi-shards database:settings:set defaultWriteSizeLimit unlimited --instance fir-multi-shards

And they both set the setting to the appropriate value. This change should also be robust to setting rules from the CLI.

@google-cla google-cla bot added the cla: yes Manual indication that this has passed CLA. label Mar 17, 2021
@jmwski jmwski requested a review from bkendall March 17, 2021 23:07
@fredzqm
Copy link
Contributor

fredzqm commented Mar 17, 2021

Oh, maybe update the CHANGE_LOG.md

Copy link
Contributor

@bkendall bkendall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment on the changelog, but looks fine otherwise

CHANGELOG.md Outdated Show resolved Hide resolved
@jmwski jmwski merged commit 1826400 into master Mar 24, 2021
@jmwski jmwski deleted the jw/database-settings-set-fix branch March 24, 2021 16:18
devpeerapong pushed a commit to devpeerapong/firebase-tools that referenced this pull request Dec 14, 2021
* Add missing JSON.stringify in database:settings:set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Manual indication that this has passed CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When applying database settings the values aren’t stringified resulting in error.
4 participants