GoogleCloudPlatform / GoogleCloudPlatform/functions-framework-nodejs

Deploy multiple TypeScript functions to Google Cloud

Offen
#610 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
P3 question
Vorherrschende Sprache
TypeScript
Sterne
1.4k
Forks
181
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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](https://github.com/GoogleCloudPlatform/functions-framework-nodejs/blob/main/docs/typescript.md)

Project structure :
![image](https://github.com/GoogleCloudPlatform/functions-framework-nodejs/assets/22203676/69b53aca-98bf-4d41-8f1a-73025da7ed66)

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?`

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit docs/typescript.md sowie dem in der Issue beschriebenen package.json- und build/functions-Aufbau. Überprüfe das erwartete Quellverzeichnis und das main-Feld für die Bereitstellung mehrerer Node.js-22-Funktionen und dokumentiere anschließend einen funktionierenden Bereitstellungsweg für mehrere Funktionen, der beide Fragen beantwortet und den gemeldeten Fehler „package.json fehlt“ behandelt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
google-cloud, nodejs, typescript
Bereich
cloud, documentation
Issue-Typ
Dokumentation
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.