question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash when importing Google Cloud Speech to Text

See original GitHub issue

Describe the bug I tried importing @google-cloud/speech, but running yarn electron:serve will eventually result in a crash.

To Reproduce

vue create vue-electron-test
cd vue-electron-test
vue add electron-builder (choose the latest Electron - 6, at the time of writing the post)
yarn add @google-cloud/speech

Add to background.js:

import speech from "@google-cloud/speech";
const client = new speech.SpeechClient({keyFilename: "credentials.json"});

Then, run:

yarn electron:serve

Expected behavior I expect the line of const client = new speech.SpeechClient({keyFilename: "credentials.json"}); to work normally, i.e. to initialize the SpeehClient() instance while using the credentials in credentials.json

Screenshots

Environment (please complete the following information):

  • OS and version: Windows 10 Pro 1903 build 18362.3356
  • node version: 10.16.3
  • npm version: 6.9.0
  • yarn version: 1.17.3
  • vue-cli-plugin-electron-builder version : ^1.4.0
  • electron version: 6.0.9
  • other vue plugins used: Nothing
  • custom config for vcp-electron-builder: Nothing
  • (if possible) link to your repo: No repo, but no need for it - just follow the steps to reproduce.

Additional context The project itself is under C:\repositories\speech-to-text-test

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nklaymancommented, Sep 25, 2019

Try marking @google-cloud/speech as an external by setting your vue.config.js to:

module.exports = {
  pluginOptions: {
    electronBuilder: {
      externals: ['@google-cloud/speech']
    }
  }
}
0reactions
avi12commented, Oct 9, 2019

Oh, I’d like to mention that in order to get it to work, the parameter --type must have the value raw, i.e. make sure that in the SoX’s arguments list, there’s "--type", "raw", Plus, I discovered that I do need to add the node-record-lpcm16 to pluginOptions.electronBuilder.externals in vue.config.js

Other than that, it works flawlessly!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Electron program crashes when trying to import Google Cloud ...
App threw an error during load Error: error reading first path in the walk C:\Repositories\protos Error: ENOENT: no such file or directory, ...
Read more >
Troubleshooting | Cloud Speech-to-Text Documentation
Learn about troubleshooting steps that you might find helpful if you run into problems using Speech-to-Text. Cannot authenticate to Speech-to-Text.
Read more >
Callin google Speech to Text API from Flask Celery is ...
Trying to run the google speech to text from celery , but worker thread is crashing. Below is the code that is being...
Read more >
Speech Recognition with Python Crash Course | Rubik's Code
... Python supports many speech recognition engines and APIs including Google Speech Engine, Microsoft Bing Voice Recognition, Google Cloud ...
Read more >
@google-cloud/speech | Yarn - Package Manager
Bug Fixes · better support for fallback mode (#918 (7cf922a) · change import long to require (#920 (375a9b0) · deps: do not depend...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found