🔧 ProgrammierungThree checks that were green for the wrong reason(16.09.2026 um 06:43 Uhr)
🔧 ProgrammierungTreat the Grader as Code, Not a Hidden Prompt(16.09.2026 um 06:49 Uhr)
🔧 Programmierung[Event Sourcing] Trying out Sekiban DCB: Implementation(16.09.2026 um 06:50 Uhr)
🔧 AI Nachrichten An LLM Is Not Your Backend — Here's What I Learned(16.09.2026 um 06:53 Uhr)
🔧 ProgrammierungA week of NVIDIA news is 5,718 articles. My filter kept 161(16.09.2026 um 06:55 Uhr)
🔧 ProgrammierungThree checks that were green for the wrong reason(16.09.2026 um 06:43 Uhr)
🔧 ProgrammierungTreat the Grader as Code, Not a Hidden Prompt(16.09.2026 um 06:49 Uhr)
🔧 Programmierung[Event Sourcing] Trying out Sekiban DCB: Implementation(16.09.2026 um 06:50 Uhr)
🔧 AI Nachrichten An LLM Is Not Your Backend — Here's What I Learned(16.09.2026 um 06:53 Uhr)
🔧 ProgrammierungA week of NVIDIA news is 5,718 articles. My filter kept 161(16.09.2026 um 06:55 Uhr)

🔧 Programmierung 🕛 vor 1 Jahr 2 Min Lesezeit
0

How to deploy Google Cloud Functions with PNPM workspaces

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

Are you struggling to deploy your monorepo project because Cloud Build doesn't know what the heck workspace:* means?

You are in the right place! In this blog I'll show you how to trick mister Google into deploying your PNPM monorepo project.





TL;DR



Just bundle everything, and ship the dist folder to Cloud functions with an empty package.json file. Ta-da! 🎩✨





This is how you do it



Create a simple deploy.sh script inside the package that contains the Cloud Function you want to deploy.




CODE
#!/bin/bash

# Install dependencies
pnpm install

# Build the project
npx esbuild \
./src/index.ts \
--bundle \
--platform=node \
--target=node20 \
--outfile=./dist/index.js \
--external:@google-cloud/functions-framework






In this file we simply install the dependencies with PNPM and bundle the source code with esbuild.

The --external:@google-cloud/functions-framework is required because functions-framework should not be bundled for some reason.

If you have some other dependencies that cannot be bundled, for example a module that uses native bindings, you should append another --external flag for that module.



Now, running the deploy.sh script will create a dist folder with the bundled code.

The only thing we are missing now is a package.json, because Cloud Functions pass through Cloud Build, which has trust issues and wants to build everything by itself.

So we are going to trick it with an empty package.json file.

Put this code right after the esbuild command:




CODE
jq -n \
--arg name "@monorepo/functions" \
--arg version "1.0.0" \
--arg main "index.js" \
--arg start "node index.js" \
--arg build "echo \"No build step\"" \
--arg ff_version "^3.3.0" \
'{
name: $name,
version: $version,
main: $main,
scripts: {
start: $start,
build: $build
},
dependencies: {
"@google-cloud/functions-framework": $ff_version
}
}'
> ./dist/package.json







We use jq to make the code more readable, but you can also use echo to write the JSON directly.

Now we just need to deploy the dist folder to Cloud Functions.

Add this last line to the deploy.sh script:




CODE
gcloud functions deploy myFunction \
--runtime=nodejs20 \
--trigger-http \
--source=./dist






And that's it! Now you can deploy your monorepo project to Cloud Functions with PNPM workspaces.

Vollständiger Original-Artikel
Den kompletten Beitrag mit allen Details direkt auf dev.to lesen.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Samsung Goes to Couples Therapy to Unpack iPhone-to-Android Tension
1 Quelle
Casetify Promo Codes | 15% Off September 2026
1 Quelle
Drohnendaten aus dem Ukraine-Krieg: Wie militärische Einsätze zu einer neuen Ressource für KI-Firmen werden
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten How to deploy Google Cloud Functions with PNPM workspaces

Thematisch verwandte Begriffe: deploy, Google, Cloud, Functions · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...