I download the lastest version of google cloud CLI, to use it with my firebase cloud function project (node, typescript), in order to deploy it with its service account JSON using this comand:
gcloud functions deploy rgDev --runtime nodejs22 --trigger-http --service-account firebase-adminsdk-fbsvc@my-project.iam.gserviceaccount.com
Hi @TheNemus,
Welcome to Google Cloud Community!
It looks like there was an issue in getting your project transpiled from Typescript to Javascript.
As a starting point, make sure that your functions project is in accordance with the preferred directory structure as illustrated here. The index.ts file (the main source code) should be under src/ while the index.js file (the transpiled Javascript code) should be under lib/. Both src and lib are two folders under the same functions folder as their parent directory.
Another reason here is that maybe not all the typescript dependencies have been properly set up. You can check out these possible workarounds:
sudo npm install -g typescript
npm run-script build
Since you’re using GCloud CLI, try using Firebase CLI to deploy your function. Afterwards, follow this helpful guide (specifically from Firebase) to properly deploy your functions using Typescript. There are two sets of instructions that would help you set this up properly: (1) if you're using an existing Typescript project, or (2) if you were migrating an existing Javascript project to a Typescript project.
I’d also suggest saving a backup copy of your functions project before testing out these tips, or you can try creating a minimal, complete and verifiable example of a Typescript function code as part of your tests.
Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.