Skip to content

Conversation

@ansnaldo
Copy link
Contributor

@ansnaldo ansnaldo commented May 27, 2025

…tabase

Pull Request

Description

Update firestore event trigger type to document instead of database which currently throws an error

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Release preparation

Reviewers

@AndrewBarber @tgerulaitis @iamsambrown @seanpertet

Release Checklist

If this PR is preparing a release, please ensure:

  • The version in package.json has been updated following Semantic Versioning principles
    • Major version bump for breaking changes
    • Minor version bump for new features
    • Patch version bump for bug fixes
  • The CHANGELOG.md has been updated with details of the changes under the [Unreleased] section
    • Added any new features under "### Added"
    • Documented any changes under "### Changed"
    • Documented any bug fixes under "### Fixed"
    • Documented any breaking changes under "### Breaking changes"
  • All tests pass locally (npm run test)
  • Code linting passes (npm run lint)
  • The PR title clearly describes the changes

Post-Merge Automation

After merging to master, the following will happen automatically:

  • The package will be published to npm
  • A GitHub release will be created with the CHANGELOG content
  • The PR will be commented with the release information

Testing

Additional Notes

@github-actions
Copy link

🚀 Beta version published: 4.1.3-beta.pr.84.20250527165950

You can install this version with:

npm install @space48/[email protected]

Copy link
Contributor

@tgerulaitis tgerulaitis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ansnaldo Strictly speaking this is a breaking change, because it's changing how Cloud Seed gen2 firestore functions work today. While we are doing to make the gen2 function work like gen1 did, if someone had the latest version of Cloud Seed installed with a firestore function and they upgrade, then their function will stop working.

Therefore, we need a major version bump in the package and a breaking change note added to the changelog, please.

@github-actions
Copy link

🚀 Beta version published: 5.0.0-beta.pr.84.20250528100948

You can install this version with:

npm install @space48/[email protected]

@github-actions
Copy link

🚀 Beta version published: 5.0.0-beta.pr.84.20250528102549

You can install this version with:

npm install @space48/[email protected]

@ansnaldo
Copy link
Contributor Author

ansnaldo commented May 28, 2025

@ansnaldo Strictly speaking this is a breaking change, because it's changing how Cloud Seed gen2 firestore functions work today. While we are doing to make the gen2 function work like gen1 did, if someone had the latest version of Cloud Seed installed with a firestore function and they upgrade, then their function will stop working.

Therefore, we need a major version bump in the package and a breaking change note added to the changelog, please.

@tgerulaitis updated. This wouldn't have been working on the previous latest version though right?

@github-actions
Copy link

🚀 Beta version published: 5.0.0-beta.pr.84.20250528114904

You can install this version with:

npm install @space48/[email protected]

@github-actions
Copy link

🚀 Beta version published: 5.0.0-beta.pr.84.20250528123841

You can install this version with:

npm install @space48/[email protected]

@tgerulaitis
Copy link
Contributor

@tgerulaitis updated. This wouldn't have been working on the previous latest version though right?

@ansnaldo I haven't tested it to prove this, so I might be wrong, but the existing code should work, just not in the way the gen1 functions would.

The document config value is currently being passed as the database filter, which filters the events for a particular database. Theoretically someone could be using it right now to create a function that gets triggered on a specific event on any document within the specified database.

So while the config value doesn't work the way it did in gen1 functions, it should still work. It's just that for our use case we need a document filter instead. So this is a change, rather than a fix.

types/runtime.ts Outdated
export type FirestoreConfig = {
type: "firestore";
document: string;
database: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ansnaldo I'm concerned that this is a required value, but it's not used for gen1 functions at all. It means that if someone upgrades Cloud Seed, but wants to keep gen1 functions, they would have to enter some dummy data that is unused.

Can we make this optional? Is it actually required for gen2 functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ansnaldo I'm concerned that this is a required value, but it's not used for gen1 functions at all. It means that if someone upgrades Cloud Seed, but wants to keep gen1 functions, they would have to enter some dummy data that is unused.

Can we make this optional? Is it actually required for gen2 functions?

@tgerulaitis good point. Yes it looks to be required looking at GCP docs. Also when I tested the first beta version (with document only) I got this error :

Error: Error creating function: googleapi: Error 400: Validation failed for trigger xxx : The request was invalid: missing required attribute "database" in trigger.event_filters
│ 
│   with google_cloudfunctions2_function.firestore-create-export,
│   on cdk.tf.json line 115, in resource.google_cloudfunctions2_function.firestore-create-export:
│  115:       },
│ 
╵

Updated now.

@github-actions
Copy link

🚀 Beta version published: 5.0.0-beta.pr.84.20250528151136

You can install this version with:

npm install @space48/[email protected]

@ansnaldo ansnaldo merged commit 35ebe83 into master Jun 10, 2025
2 checks passed
@ansnaldo ansnaldo deleted the S48-XX_Update-firestore-trigger-type branch June 10, 2025 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants