google-cloud-php icon indicating copy to clipboard operation
google-cloud-php copied to clipboard

Add support for STORAGE_EMULATOR_HOST

Open universe-42 opened this issue 3 years ago • 1 comments

I see lot of closed issues with emulators host support, but I am currently missing emulator for Storage.

Thanks a lot

universe-42 avatar Feb 01 '22 15:02 universe-42

plus1 for Storage emulator support

f1nder avatar May 30 '22 12:05 f1nder

We have apiEndpoint in client which can be overridden. code pointer ref

vishwarajanand avatar May 06 '23 12:05 vishwarajanand

Thanks @vishwarajanand, but how can I force HTTP instead of HTTPS (which Firebase emulator currently not support)?

cURL error 35: OpenSSL/3.0.8: error:0A00010B:SSL routines::wrong version number (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://firebase:9199/upload/storage/v1/b/snoofa/o?uploadType=multipart

$s = new StorageClient([
  'apiEndpoint' => 'firebase:9199'
]);

$b = $s->bucket('test');

$b->upload('hello world', [
  'name' => 'readme.txt',
]);

universe-42 avatar May 25 '23 06:05 universe-42

@universe-42 it seems you're trying to use Firebase storage emulator as described in this doc.

We don't have a fully functional storage emulator which has all Storage APIs implemented. We use Storage Testbench, ref code pointer which is a little closer and can work with http as well. I got it to work as:

docker run -it -p 9000:9000 gcr.io/cloud-devrel-public-resources/storage-testbench:v0.37.0

Hope this helps. Closing this case, since the question is already answered.

vishwarajanand avatar Aug 09 '23 08:08 vishwarajanand