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

Admin SDK getFiles() doesn't work on emulator #3778

Closed
ApoorvaJ opened this issue Sep 23, 2021 · 2 comments · Fixed by #3647
Closed

Admin SDK getFiles() doesn't work on emulator #3778

ApoorvaJ opened this issue Sep 23, 2021 · 2 comments · Fixed by #3647

Comments

@ApoorvaJ
Copy link

ApoorvaJ commented Sep 23, 2021

This is a direct duplicate of #3589, but I'd like to elaborate on why this feature is important to have.

I'm using Firebase Storage, and disallowing list or listAll in security rules. Authorized clients can call a cloud function with a list of files to retain, and the cloud function deletes everything in that path, except the retain list.

Currently, there's no way to test this in the emulator, since admin.storage().bucket(...).getFiles() currently returns []. I've already verified that the files exist, and that I can delete them or update their metadata using the admin API, as it states in the docs here.

"Using the Admin SDK, only uploading files, downloading files, and modifying file metadata are supported. Other functionality provided by Google Cloud Storage client libraries is not yet available."

Listing files in cloud functions using the admin SDK is a crucial component of my security, and currently this limitation makes it impossible to test on the emulator.

While this is a feature request in a bug report's clothing, I'm posting it as such because I think returning an empty array as response to getFiles() is misleading and took me a long time to nail down as a limitation of the emulator. :) Until this feature is made available, it would be nice to throw an unimplemented error message or something similar.

I'm on MacOS, firebase-admin 9.11.1, and firebase-tools 9.18.0.

@josh18
Copy link

josh18 commented Oct 29, 2021

While this is a feature request in a bug report's clothing, I'm posting it as such because I think returning an empty array as response to getFiles() is misleading and took me a long time to nail down as a limitation of the emulator. :) Until this feature is made available, it would be nice to throw an unimplemented error message or something similar.

Same thing happened to me, I spent a lot time thinking I was doing something wrong 😭

Even more confusing, it works when you use the prefix option?? Which made me even more convinced that I was doing something wrong.

@rhodgkins
Copy link
Contributor

I had similar problems so implemented various missing features of the Storage emulator - its still waiting to be merged :-/
You could try working against this and see if it fixes your problem and try upvoting / commenting on the PR.

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

Successfully merging a pull request may close this issue.

5 participants