From 5329bd03e80764b0dcad81ddb3845d801699f10d Mon Sep 17 00:00:00 2001 From: ansoucamara Date: Tue, 27 May 2025 16:40:29 +0100 Subject: [PATCH 1/8] S48-XX: update firestore event trigger type to document instead of database --- stacks/gcp/GcpStack.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/stacks/gcp/GcpStack.ts b/stacks/gcp/GcpStack.ts index 3c2a96f..3334abb 100644 --- a/stacks/gcp/GcpStack.ts +++ b/stacks/gcp/GcpStack.ts @@ -336,7 +336,7 @@ export default class GcpStack extends TerraformStack { retryPolicy, eventFilters: [ { - attribute: "database", + attribute: "document", value: config.document, }, ], @@ -412,9 +412,8 @@ export default class GcpStack extends TerraformStack { resource = "scheduled-" + config.name; break; case "firestore": - eventType = `providers/cloud.firestore/eventTypes/document.${ - config.firestoreEvent || "write" - }`; + eventType = `providers/cloud.firestore/eventTypes/document.${config.firestoreEvent || "write" + }`; resource = config.document; break; case "storage": From cd5dc6b7aae64b10fffc77a857a8cd7628d896e8 Mon Sep 17 00:00:00 2001 From: ansoucamara Date: Tue, 27 May 2025 17:54:10 +0100 Subject: [PATCH 2/8] S48-XX: update package version and changelog --- CHANGELOG.md | 7 ++++++- package-lock.json | 4 ++-- package.json | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d77cf66..2cab206 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased](https://github.com/Space48/cloud-seed/compare/v4.1.0...HEAD) +### Fixed + +- Fixed an "Unsupported" error when deploying `Firestore` functions with `event trigger filter attribute` set to `database` instead of `document` + +## [4.1.2](https://github.com/Space48/cloud-seed/compare/v4.1.0...v4.1.2) + ### Added - Added CONTRIBUTING.md with comprehensive contribution guidelines @@ -45,7 +51,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated package dependencies - Enhanced type safety for environment-specific configurations - ## [v3.0.0](https://github.com/Space48/cloud-seed/compare/v2.1.0...v3.0.0) ### Breaking changes diff --git a/package-lock.json b/package-lock.json index 3f8d415..0a679f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@space48/cloud-seed", - "version": "4.1.2", + "version": "4.1.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@space48/cloud-seed", - "version": "4.1.2", + "version": "4.1.3", "license": "MIT", "dependencies": { "@cdktf/provider-archive": "^10.3.0", diff --git a/package.json b/package.json index ec6438e..c83e73c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@space48/cloud-seed", - "version": "4.1.2", + "version": "4.1.3", "description": "Cloud infrastructure automation tool that uses Terraform CDK.", "main": "dist/index.js", "bin": { @@ -59,4 +59,4 @@ "lint-staged": { "*.{js,ts}": "eslint --cache --fix" } -} +} \ No newline at end of file From a03f911cc674ff5c2276e367a7fc937073d3c84e Mon Sep 17 00:00:00 2001 From: ansoucamara Date: Tue, 27 May 2025 17:57:57 +0100 Subject: [PATCH 3/8] S48-XX: update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cab206..9e74d60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased](https://github.com/Space48/cloud-seed/compare/v4.1.0...HEAD) +## [Unreleased](https://github.com/Space48/cloud-seed/compare/HEAD...v4.1.3) ### Fixed From c1ec383bde223667c539529c8b79d2fe65827d35 Mon Sep 17 00:00:00 2001 From: ansoucamara Date: Wed, 28 May 2025 11:08:28 +0100 Subject: [PATCH 4/8] S48-XX: bump version to 5.0.0 due to breaking change --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0a679f8..884abcc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@space48/cloud-seed", - "version": "4.1.3", + "version": "5.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@space48/cloud-seed", - "version": "4.1.3", + "version": "5.0.0", "license": "MIT", "dependencies": { "@cdktf/provider-archive": "^10.3.0", diff --git a/package.json b/package.json index c83e73c..2e48c93 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@space48/cloud-seed", - "version": "4.1.3", + "version": "5.0.0", "description": "Cloud infrastructure automation tool that uses Terraform CDK.", "main": "dist/index.js", "bin": { From e94d5479d929151f3831a20e6e05f9b40cca9af0 Mon Sep 17 00:00:00 2001 From: ansoucamara Date: Wed, 28 May 2025 11:24:54 +0100 Subject: [PATCH 5/8] S48-XX: update changelog --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e74d60..eb5a81c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased](https://github.com/Space48/cloud-seed/compare/HEAD...v4.1.3) +## [Unreleased](https://github.com/Space48/cloud-seed/compare/HEAD...v5.0.0) -### Fixed +### Breaking changes -- Fixed an "Unsupported" error when deploying `Firestore` functions with `event trigger filter attribute` set to `database` instead of `document` +- `Firestore` functions `event trigger filter attribute` are now set to `document` instead of `database`. Ensure you update and complete full regression testing of your firestore functions after upgrading ## [4.1.2](https://github.com/Space48/cloud-seed/compare/v4.1.0...v4.1.2) From dfd5c35ac380db1f0120359852ae36d4edef2361 Mon Sep 17 00:00:00 2001 From: ansoucamara Date: Wed, 28 May 2025 12:47:59 +0100 Subject: [PATCH 6/8] S48-XX: update firestore event filters to include database as well as document --- stacks/gcp/GcpStack.ts | 9 +++++++-- types/runtime.ts | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/stacks/gcp/GcpStack.ts b/stacks/gcp/GcpStack.ts index 3334abb..f8d2123 100644 --- a/stacks/gcp/GcpStack.ts +++ b/stacks/gcp/GcpStack.ts @@ -339,6 +339,10 @@ export default class GcpStack extends TerraformStack { attribute: "document", value: config.document, }, + { + attribute: "database", + value: config.database, + }, ], }, }; @@ -412,8 +416,9 @@ export default class GcpStack extends TerraformStack { resource = "scheduled-" + config.name; break; case "firestore": - eventType = `providers/cloud.firestore/eventTypes/document.${config.firestoreEvent || "write" - }`; + eventType = `providers/cloud.firestore/eventTypes/document.${ + config.firestoreEvent || "write" + }`; resource = config.document; break; case "storage": diff --git a/types/runtime.ts b/types/runtime.ts index f5a5941..4689ae8 100644 --- a/types/runtime.ts +++ b/types/runtime.ts @@ -60,6 +60,7 @@ export type QueueConfig = { export type FirestoreConfig = { type: "firestore"; document: string; + database: string; firestoreEvent?: "create" | "write" | "update" | "delete"; } & FunctionConfig; From dcfed17891c70eb7c825f21ca92377fd2b3ac47c Mon Sep 17 00:00:00 2001 From: ansoucamara Date: Wed, 28 May 2025 13:37:48 +0100 Subject: [PATCH 7/8] S48-XX: update changelog to include addition of database attribute for firestore functions config --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb5a81c..91a926e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Breaking changes -- `Firestore` functions `event trigger filter attribute` are now set to `document` instead of `database`. Ensure you update and complete full regression testing of your firestore functions after upgrading +- `Firestore` functions `event trigger filter attribute` now includes `database` in addition to `document`. Ensure you update and complete full regression testing of your firestore functions after upgrading ## [4.1.2](https://github.com/Space48/cloud-seed/compare/v4.1.0...v4.1.2) From a0c5d845850649859b9c8e58a989258c90cfb21c Mon Sep 17 00:00:00 2001 From: ansoucamara Date: Wed, 28 May 2025 16:10:41 +0100 Subject: [PATCH 8/8] S48-XX: make the database firestore config attribute optional to support gen1 functions --- stacks/gcp/GcpStack.ts | 2 +- types/runtime.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stacks/gcp/GcpStack.ts b/stacks/gcp/GcpStack.ts index f8d2123..38b3268 100644 --- a/stacks/gcp/GcpStack.ts +++ b/stacks/gcp/GcpStack.ts @@ -341,7 +341,7 @@ export default class GcpStack extends TerraformStack { }, { attribute: "database", - value: config.database, + value: config.database || "(default)", }, ], }, diff --git a/types/runtime.ts b/types/runtime.ts index 4689ae8..414996f 100644 --- a/types/runtime.ts +++ b/types/runtime.ts @@ -60,7 +60,7 @@ export type QueueConfig = { export type FirestoreConfig = { type: "firestore"; document: string; - database: string; + database?: string; firestoreEvent?: "create" | "write" | "update" | "delete"; } & FunctionConfig;