GoogleCloudPlatform / functions-framework-nodejs

FaaS (Function as a service) framework for writing portable Node.js functions
Apache License 2.0
1.28k stars 158 forks source link

Deploy multiple TypeScript functions to Google Cloud #610

Open peckpeck20 opened 1 month ago

peckpeck20 commented 1 month ago

How can I build and deploy multiple TS cloud functions from the same codebase?

I'm following your TS guide which focuses on the single function use case -> docs/typescript.md

Project structure : image

Deploy command :

gcloud functions deploy catalogUpdateFunction \ --gen2 \ --region=europe-north1 \ --runtime=nodejs22 \ --source=. \ --entry-point=catalogUpdateFunction \ --trigger-http

Open questions:

  1. What should be the value of the main field in package.json ?
  2. What should the source be for the deploy command?

Setting the source value to --source=./build/functions \ fails with the following error: ERROR: (gcloud.functions.deploy) Invalid value for [--source]: Provided source directory does not have file [package.json] which is required for [nodejs22]. Did you specify the right source?