googleapis / nodejs-speech

This repository is deprecated. All of its content and history has been moved to googleapis/google-cloud-node.
https://cloud.google.com/speech/
Apache License 2.0
689 stars 291 forks source link

Local Storage Emulator #873

Closed travrob1 closed 1 year ago

travrob1 commented 2 years ago

Hello.
We have a service that uses google-cloud/speech

const speech = require('@google-cloud/speech').v1p1beta1;

We also are highly integrated with firebase. Firebase offers cloud storage, which is a wrapper around google cloud storage. Using firebase storage, we are able to successfully transcribe a file.


var request = {
audio: {uri: gs://default-bucket/documents/123/audio.mp3},
...
}

speech.SpeechClient().longRunningRecognize(request)

However, the issue we are running into, is that firebase offers a storage emulator

When we use the emulator, the bucket url is only created locally, there is no actual location. Im wondering if there is a manual way to either pass the binary to the longRunningRecognize or enable it to use the local storage emulator.

Firebase's admin sdk offers a env variable (FIREBASE_STORAGE_EMULATOR_HOST) that can be set so that it knows to use the locally running storage emulator vs the actual production one. Im wondering if something like that exists or could be built.

Thanks

Environment details

Steps to reproduce

  1. Create a simple service that uses Firebase Admin sdk and makes a request to cloud storage.
  2. Run the storage emulator as described here
  3. Set the env variable FIREBASE_STORAGE_EMULATOR_HOST=localhost:9199
  4. Run the service.
  5. Attempt to call speech.SpeechClient().longRunningRecognize(request) with a requested url that you got from the admin storage.

I understand that this service is not firebase. I'm sure though i am not the first person to want to use the speech api with a locally emulated storage. I think this would make developing locally much easier, since you would not have to test and develop agains a production cloud storage.

Thanks Travis

meredithslota commented 1 year ago

This library is being migrated to the consolidate Node.js client library repo here: https://github.com/googleapis/google-cloud-node Since this issue is somewhat stale (apologies), please open a new issue in the combined repo and share additional details about your request for what kind of errors you're seeing. There's guidance here for Node.js configuration: https://firebase.google.com/docs/emulator-suite/connect_storage#node.js-admin-sdk