Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Cloud Function Deployment - Invalid Memory Property

My firebase cloud function (TypeScript) has included the runtimeOption by referring to official doc https://firebase.google.com/docs/functions/manage-functions#set_timeout_and_memory_allocation

const runtimeOpts = {
  timeoutSeconds: 540,
  memory: "1GB"
}
..
export const GCPSpeech2TranscriptLRR = functions.runWith(runtimeOpts).https.onRequest((req, res) => {

It returns deployment error

src/index.ts:145:58 - error TS2345: Argument of type '{ timeoutSeconds: number; memory: string; }' is not assignable to parameter of type 'RuntimeOptions'.
  Types of property 'memory' are incompatible.
    Type 'string' is not assignable to type '"128MB" | "256MB" | "512MB" | "1GB" | "2GB" | undefined'.

145 export const GCPSpeech2TranscriptLRR = functions.runWith(runtimeOpts).https.onRequest((req, res) => {

I have tried both memory: "1GB", memory: '1GB' but yet i get the same error. If i removed the 'memory : ...' line,it will deploy correctly. Even after the CF deployed successfully, it still return error below within 2 mins. From what i awared, the code supposed to run for 9mins

Subscriber.js:192 Error: deadline-exceeded
    at new HttpsErrorImpl (index.cjs.js:58)
    at index.cjs.js:373
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
    at push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask (zone.js:503)
    at ZoneTask.invoke (zone.js:492)
    at timer (zone.js:3034)
like image 604
Weilies Avatar asked Dec 05 '25 04:12

Weilies


1 Answers

This looks like an issue with the Typescript compiler's inference. Try with:

memory: "1GB" as "1GB"
like image 194
David Avatar answered Dec 07 '25 03:12

David



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!