0

I'm working on a GAS project with Speech to Text API. It's converting flac file, while the file is large than 2MB, execution is interrupted and got "Exceeded memory limit" error in the GAS code editor. Is there anyway I can catch such error in my code? And any way to avoid such error?

I have checked "Quotas for Google Services", my project should not meet any of the criteria.

My project is https://github.com/mushuser/audiolib , stt.gs is the Speech to text parts.

tfchen
  • 539
  • 2
  • 6
  • 12

1 Answers1

1

Yep, Exceeding memory limit is possible because You keep content of file(s) in variable.

Google Script is intended to simple and light automation tasks, but essentially task should be only connection commands between few services.

Some limit like Memory limit is not simple defined, they are dynamic (you can store more data in memory across multiple objects than you can save in one variable for example) and can be changed as prevent to abuse (this service is free, it could be abused to consume lot of compute power or memory).

Try to check if Speech to Text API accept input data as URL to content (getDownloadUrl()) instead of send data directly in payload - this will cause the big file content will be exchanged between services outside of Script.

Jakub Bouček
  • 1,366
  • 10
  • 15