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

firebase database:set --confirm reports "STDIN input not available for Windows" #1221

Closed
tohagan opened this issue Apr 26, 2019 · 6 comments
Closed

Comments

@tohagan
Copy link

tohagan commented Apr 26, 2019

[REQUIRED] Environment info

firebase-tools: 6.7.1

Platform: Windows 10
Shell: bash (Mingw)

[REQUIRED] Test case

 $ echo ./some/path/TEST.json | firebase database:set //some/path/TEST --confirm

NOTE: the path required two slashes // due to another BUG that's already been reported.

[REQUIRED] Steps to reproduce

  1. echo ./some/path/TEST.json | firebase database:set //some/path/TEST --confirm

  2. Outputs

    Error: STDIN input is not available on Windows.

[REQUIRED] Expected behavior

No Error

[REQUIRED] Actual behavior

STDIN error

So basically there is no way using the current CLI to automate importing JSON files.
There are 2 BUGS here actually, one previously reported.

@tohagan
Copy link
Author

tohagan commented Apr 26, 2019

You also cannot run ...

 $ firebase database:set //course/en/TEST ./course/en/TEST.json --confirm

... as you'd expect since the --confirm forces you to use STDIN which is broken on Windows.

So 3 bugs/limitations here:

  1. Contrary to documentation paths must start with '//' not '/' as documented in Blog Post See On database:set: Error: Path must begin with / #231
  2. --confirm cannot be used without STDIN
  3. Using STDIN is broken on Windows

@tohagan
Copy link
Author

tohagan commented Apr 26, 2019

For my fellow Firebase devs who stumble on this issue ... this tool might be useful:

@tohagan
Copy link
Author

tohagan commented Apr 26, 2019

NodeJs since 8.3.0 can read STDIN on Windows (fix: nodejs/node#10836) and Firebase has migrated to Node 8.15.0 or later.

You could remove your STDIN constraint by testing if(IS_WINDOWS && semver.lt(process.version, '8.3.0')) and recommend a Node upgrade instead.

@tinaliang
Copy link
Contributor

Thank you for the feedback @tohagan! Can you confirm that upgrading to Node version 8.3.0 fixes the problem for you? If so, we always welcome PRs, and I would be happy to review one from you! Please refer to contribution.md for how to make contributions to the Firebase CLI.

@mbleigh
Copy link
Contributor

mbleigh commented May 3, 2019

Note that to set the contents of a file, you don't need to pipe:

firebase database:set --confirm /path/to/set file_to_set.json

The above will read the contents of file_to_set.json and set them to the database at the specified path.

@tohagan
Copy link
Author

tohagan commented May 26, 2019

That now works! Thanks. I'm running Node 8.15.0 locally and upgraded to latest firebase CLI 6.10.0

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

4 participants