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

Can't get files on storage emulator with getFiles() #3589

Closed
samhammer325 opened this issue Jul 19, 2021 · 1 comment
Closed

Can't get files on storage emulator with getFiles() #3589

samhammer325 opened this issue Jul 19, 2021 · 1 comment

Comments

@samhammer325
Copy link

[REQUIRED] Environment info

firebase-tools@9.16.0

9.16.0

macOS

[REQUIRED] Test case

const {Storage} = require('@google-cloud/storage');

//use project name
var storage = new Storage({
projectId: projectname,
});

var anyfile = await storage.bucket("default-bucket").getFiles();

[REQUIRED] Steps to reproduce

run firebase functions and firebase storage emulator

add a file to cloud storage emulator
objectis {
kind: '#storage#object',
name: 'result.txt',
bucket: 'default-bucket',
generation: '1626727265697',
metageneration: '1',
...
}

try to get files with firebase function

[REQUIRED] Expected behavior

[
File {
domain:
Domain {
domain: null,
_events: [Object],
_eventsCount: 3,
_maxListeners: undefined,
members: [],
[Symbol(kWeak)]: WeakReference {} },
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
metadata:
{ kind: 'storage#object',
...
]

[REQUIRED] Actual behavior

nothing returned
[]

(works on production db but not in emulator)

@adrianleewt
Copy link

I'm not an expert in working with the emulators, but in the docs for the storage emulator here it says:

"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."

I haven't been able to get getFiles() working either, so in my tests I just keep track of what I'm uploading to the emulator, and then check for the existence of each item using the bucket.file(filename).exists() method. Perhaps the getFiles() method just isn't implemented yet for emulator?

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

No branches or pull requests

2 participants